1. Go to this page and download the library: Download dskripchenko/laravel-api 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/ */
dskripchenko / laravel-api example snippets
use Dskripchenko\LaravelApi\Components\BaseApi;
class Api extends BaseApi
{
public static function getMethods(): array
{
return [
'controllers' => [
'{controllersKey1}' => [
'controller' => '{Controller::class}',
'actions' => [
'{actionKey1}', // api/version/{controllersKey1}/{actionKey1}
'{actionKey2}' => '{real method name}', //api/version/{controllersKey1}/{actionKey2}
'{actionKey3}' => false, //disable //api/version/{controllersKey1}/{actionKey3}
'{actionKey4}' => [
'exclude-all-middleware' => true, //optional, exclude all global and controller middleware
'middleware' => [
"{Middleware::class}"
], //optional, define specific middleware
'exclude-middleware' => [], //optional, exclude specific middleware
],
],
'exclude-all-middleware' => true, //optional, ...
'middleware' => [], //optional, ...
'exclude-middleware' => [], //optional, ...
]
],
'middleware' => [] //optional, ...
];
}
}
/**
* Method title
* Method description
*
* @input type $erMetaInputs]
*
* @output type $variable1 name1
* @output type $variable2 name2
*/
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.