PHP code example of lararest / restapi-generator

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

    

lararest / restapi-generator example snippets

bash
php artisan vendor:publish --provider="lararest\\RestApiGenerator\RestApiGeneratorServiceProvider" --tag="config"

Next, if you plan for cross origin support, you should add middleware to your api middleware group within your app/Http/Kernel.php file:
'ApiHeaderInject'

add in env
for allow cross origin support
API_ALLOW_CROSS_ORIGIN = true
for json content type
API_JSON_RESPONSE = true
 php
php artisan api:gen --model=User