Fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger.
This allows a fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger for the documentation.
The objective is to have the least code to write for adding new kind of content: the most important process is carried out in the Abstract files.
In a development environment, the display of the Debugbar (barryvdh/laravel-debugbar) has been modified in a Middleware to integrate with the json return.
Several levels of caches are used to optimize the display: a first one with the bundle genealabs/laravel-model-caching for Objects, a second one in the process of the Resources display, and a third one with a configurable Cache-Control in Header.
By default, GET routes are behind cache. To remove that, you have to add the following GET parameter:
removeCache=true
Here are the requirements for the project:
sh scripts/install.sh
If for some reasons your project stop working, do the following:
cd website
composer install
php artisan migrate
cd website
sh scripts/refresh_cache.sh
cd website
sh scripts/reset_database.sh
cd website
sh scripts/generate_data.sh
cd website
php artisan migrate
* * * * * cd /path-to-your-project && php artisan schedule:run
cd website
php artisan l5-swagger:generate
L5_SWAGGER_GENERATE_ALWAYS
to true
in your .env file. It will allow your documentation to be automatically generated.You can retrieve an User Token from the route /users/auth/login in Authentication Tag on Swagger interface. Copy this token and past it in "Authorize" button (see above right of the Swagger interface) to activate the JWT mode