APIs generator was developed for laravel 5.8+ to accelerate your work by building for your new api just a few clicks.
this package came with a base controller which helps to handle some logic and generate responses, we will develop all functions that help developers to reduce development time, simple interface to manage api creations process and view all api you had made before based on the credential JSON file.
this package auto-build :
- Model : with fill fillable properties depending on the values you chose.
- Request : with validations rules and handle validation error message.
- Controller : with full crud process based on the base controller.
- Resource : to get resources data from the model.
- Migration : with auto-generate for your database columns.
- Friendly simple interface to create your api with dark mode option using Darkmode.js.
- Giving you the choice to choose what to build.
- The large development space in the future update.
The first step is using composer to install the package and automatically update your composer.json file, you can do this by running:
composer require kmlaravel/apis-generator
3 - Copy the package providers to your local config with the publish command, this will publish asset and config :
php artisan vendor:publish --provider="KMLaravel\ApiGenerator\Providers\ApisGeneratorServiceProviders"
php artisan vendor:publish --tag=apis-generator-config
In apis_generator.php
configuration file you can determine the properties of the default values and some behaviors.
php artisan vendor:publish --tag=apis-generator-asset
As we said a little while ago we save your process result in resource/views/ApiGenerator/credential.josn
this file contains an array that in turn contains objects each one contains controller class name, URL, api title, and type for your api.
to run this route we have to add this facade class in your routes/api.php
file.
\KMLaravel\ApiGenerator\Facade\KMRoutesFacade::getRoutes();
now all your routes load automatically from routes in credential.json
file.
you should navigate to {{ your base url }}/apis-generator/create
.
you can navigate to {{ your base url }}/apis-generator/index
.
the initial package route middleware is web
if you want to add any custom middleware you can do that by adding middleware keys in middleware arrays
/*
|--------------------------------------------------------------------------
| package routes middleware
|--------------------------------------------------------------------------
|
| this middleware array if you want to add custom middleware to package route,
| this is applies to ( /apis-generator/index ) and ( /apis-generator/create ).
|
*/
//example
"middleware" => [
'admin',
],
you can do that by adding the type label to column_type array
/*
|--------------------------------------------------------------------------
| types of the column in database which laravel provider.
|--------------------------------------------------------------------------
|
| the options in database column select in creating a view,
| you can add or optimize this column.
|
*/
"column_type" => [
'text',
'string',
...
],
Please see the CHANGELOG for more information about what has changed or updated or added recently.
If you discover any security related issues, please email them first to [email protected], if we do not fix it within a short period of time please open a new issue describing your problem.