09
DecApi Auto Pilot is a Laravel package for building RESTful APIs amazingly fast. It is inspired by the Strapi Restful API and its main goal is to get you an API for your database in just a matter of minutes.
Simply require the package from the composer, run the installation command, and all your Models, are exposed as a REST API. Cool, right? Api Auto Pilot provides you with the best starting point for your next Laravel CRUD API.
You can install the package via composer:
composer require apiautopilot/apiautopilot
After you required the packager from packagist, make sure to run the installation command:
php artisan apiautopilot:install
API Routes File
When the installation of the package, is completed, you may notice that, in your routes/api.php file 3 lines of code were added. if you had any previous API routes they are left as they were, nothing is changed. See more at: Configuring Routes
//routes/api.php
Route::prefix('/aap')->group(function () {
ApiAutoPilot\AutoPilotApi\Facades\AutoPilotApi::routes();
});
Http Kernel File
After the installation of the package, a route middleware has been registered in the app/http/kernel.php file, in the $routeMiddleware array . That middleware is responsible for handling route resolves. Do not delete the middleware from the array, else the models’ routes handled by Api Auto Pilot will result in a 404 Not Found HTTP Response
//app/Http/Kernel.php
protected $routeMiddleware = [
'modelSearch' => \ApiAutoPilot\AutoPilotApi\Http\Middleware\ModelSearch::class,
...
];
Configuration File
The installation command publishes the config file automatically. If for any reason you need to re-publish the configuration file again you can do so by using:
php artisan vendor:publish --tag="apiautopilot-config"
For more details, you can visit Github
Published at : 09-12-2022
I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.
Launch project