コード例 #1
0
ファイル: index.php プロジェクト: safaa-alnablsi/Restful-API
<?php

require_once 'vendor/restler.php';
require_once 'classes/Transaction.php';
use Luracast\Restler\Restler;
//remove .json from urls of all service methods
Resources::$placeFormatExtensionBeforeDynamicParts = false;
$r = new Restler();
$r->refreshCache();
$r->setSupportedFormats('JsonFormat');
$r->addAPIClass('Transactionservice');
$r->addApiClass('Resources');
//this produces the needed resources.json
$r->handle();
コード例 #2
0
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__ . '/../bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Configure your Web Application
|--------------------------------------------------------------------------
*/
use Luracast\Restler\Restler;
use Luracast\Restler\Format\HtmlFormat;
$r = new Restler(true);
$r->setSupportedFormats('JsonFormat', 'HtmlFormat');
$r->addApiClass('Explorer');
$r->addApiClass('Authors');
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application set up, we can simply let it handle the
| request and response
|
*/
$r->handle();