PHP code example of nf / restapi

1. Go to this page and download the library: Download nf/restapi 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/ */

    

nf / restapi example snippets


  'providers'  => [
        // .... Others providers 
        \NightFury\RestApi\Providers\RestApiProvider::class,
    ],



use NF\Facades\App;
use NightFury\RestApi\Routing\Router;

$api = App::make(Router::class);

$api->version('v1', function ($api) {
    $api->get('test', 'App\Http\Controllers\TestController@test');
    $api->get('test/{id}', 'App\Http\Controllers\TestController@show');
    // ... more route goes here
});

return $api;


php command restapi:publish