1. Go to this page and download the library: Download fuzz/api-server library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fuzz / api-server example snippets
namespace MyApp\Providers;
use Fuzz\ApiServer\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
// ...
}
namespace MyApp\Exceptions;
use Fuzz\ApiServer\Exception\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
// ...
}
class MyBaseController extends Fuzz\ApiServer\Routing\Controller {}
class MySpecificController extends MyBaseController
{
public function someEndpoint() {
return $this->succeed('Foobar!');
}
}
Route::get('some-endpoint', 'MySpecificController@someEndpoint');
// ...
Route::controller(null, 'MyBaseController');
namespace MyApp\Http\Controllers;
use Fuzz\ApiServer\Routing\ResourceController as BaseResourceController;
class ResourceController extends BaseResourceController
{
// ...
}