Download the PHP package rygilles/laravel-api-boilerplate without Composer
On this page you can find all versions of the php package rygilles/laravel-api-boilerplate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rygilles/laravel-api-boilerplate
More information about rygilles/laravel-api-boilerplate
Files in rygilles/laravel-api-boilerplate
Package laravel-api-boilerplate
Short Description Laravel API Boilerplate project.
License MIT
Informations about the package laravel-api-boilerplate
Laravel API Boilerplate
This is a Laravel Laravel 5.* based project.
Prerequisites
- PHP 7.*+ (for Laravel 5.5+ framework)
- Node.js 6.*+
- Redis 3+
- Laravel Echo Server 1.3.*+ installed globally
- PM 2 (Optional : Run Laravel Echo Server as a "daemon")
Setup
Run this command and make sure to chmod properly the storage and cache folders.
Or install this project manually by cloning with git. In this case, you must copy the .env.example file to .env and run this command :
.env file
Check the .env file and change the values according to you preferences.
Libs
This project uses the same libraries as Laravel common projects.
But also (Check package.json file for details) :
Production environment
PHP, with composer
- alsofronie/eloquent-uuid for User, UserGroup and Notification models.
- bugsnag/bugsnag-laravel for debug purpose (Set BUGSNAG_API_KEY in your .env file).
- dingo/api for Api features.
- felixkiss/uniquewith-validator for advanced validation rule.
- filp/whoops for better error display in debug mode.
- predis/predis for interactions with redis server and laravel-echo-server.
- rygilles/laravel-apidoc-generator for generating Api documentation.
- rygilles/laravel-openapi-schema-generator for generating Open API json file.
Back-office, Node.js dependencies
- laravel-echo : Laravel Echo is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by Laravel.
- socket.io-client : Realtime application framework (client) used with Laravel Echo.
Development environment
- nikic/php-parser : PHP parsing (Used with the
php artisan app:makeApiModelResource
command). - twig/twig : Twig template rendering (Used with the
php artisan app:makeApiModelResource
command). - barryvdh/laravel-ide-helper package : Tool for generating Laravel definitions (PhpDoc) php file. Adding auto-complete in your IDE.
Back-office, Node.js dependencies
Vue.js :
- vue : Vue.js javascript framework for back-office UI.
- vuex : Centralized state management for Vue.js.
- vue-router : Official router for Vue.js.
- vue-i18n : Translations management in Vue.js.
- vue-gravatar : A dead-simple gravatar component for Vue.js.
Graphics :
- admin-lte : Back-office dashboard and control panel.
- bootstrap-less and bootstrap-sass : Used with AdminLTE.
- node-sass : Used with AdminLTE.
- font-awesome : Used with AdminLTE.
- ionicons : Used with AdminLTE.
- noty : Live notifications UI.
- datatables.net-select-dt : Used for custom data table component styles.
Laravel :
- laravel-mix : An elegant wrapper around Webpack for the 80% use case.
- cross-env : Cross platform setting of environment scripts.
Miscellaneous :
- jquery : Used with AdminLTE.
- axios : Authentication and Api requesting.
- pace : Dynamic loading bar (Top of the screen).
- lodash : JavaScript utility library used with Vue.js.
- moment : Dates formatter.
Database
This application use InnoDB tables for foreign keys constraint support and utf8mb4_unicode_ci encoding for modern chars support (including emoji). It also use UUID (128 bits).
Initialize
Run this command to create the database basics with default migrations (check database/migrations directory).
Make sure Redis is installed properly.
This will install :
Laravel basic tables : user, password_resets, notification, jobs
Passport bundle tables : oauth_auth_codes, oauth_access_tokens, oauth_refresh_tokens, oauth_clients_table, oauth_personal_access_clients)
Boilerplate tables : i18n_lang, user_group
Samples Data
An Artisan command (See below) can supply your database with samples data for users, projects, etc, for testing and documentation generation purpose.
Check database/seeds/Samples folder for more information.
User ID | User Group ID | Name | Password | |
---|---|---|---|---|
41abdec2-1389-11e7-93ae-92361f002671 |
Developer | John Doe | [email protected] | johndoe |
509dd5c0-1389-11e7-93ae-92361f002671 |
Support | Alan Smithee | [email protected] | alansmithee |
605c7610-1389-11e7-93ae-92361f002671 |
End-User | John Smith | [email protected] | johnsmith |
82b5da82-138c-11e7-93ae-92361f002671 |
End-User | Mickey Mouse | [email protected] | mickeymouse |
Node, Laravel Mix and Laravel Echo Server
NodeJs
Install NodeJs dependencies (check package.json file for more information).
Laravel Mix
Assets
Create your own back-office images by replacing :
- resources/assets/img/dashboard-logo.png (50 x 200)
- resources/assets/img/dashboard-mini-logo.png (50 x 50)
- resources/assets/img/favicon.jpg
Check the webpack.mix.js to enable favicon.jpg copy and manage you own assets.
Compilation
Run this command to compile the assets
Laravel Echo Server
Real-time notifications and events are send by a local Node.js server, using Redis and Socket.io.
The whole process is handled by laravel-echo-server.
Initialize Laravel Echo Server by creating laravel-echo-server.json configuration file with this command :
Start and Auto-restart
Use PM2 for auto-restart feature
Make sure you've configured all in laravel-echo-server.ecosystem.config.json file. :
Or use this command to manually start the server :
Artisan commands
app:makeFresh
This command will reset/refresh migrations, re-create required database data and (optionally) create a fresh app with samples data.
app:generateApiDocs
Generate API documentation using current database resources.
Make sure you've configured all in config/apidocs.php file.
app:makeApiModelResource
Only in development environment !
Generate and MODIFY source files to add a new model with related files :
- Model : Created in app/Models folder.
- Migration (Optional) : Created in database/migrations folder.
- Init seeder (Optional) : Created in database/seeds/InitSeeder.php file !
- Samples seeder (Optional) : Created in database/seeds/Samples/SamplesSeeder.php file !
- Controller (Optional) : Created in routes/api.php file !
- Requests : Will be generated if "store" method or "update" method making is wanted. In app/Http/Requests folder.
- Transformer : Will be generated if needed. In app/Http/Transformers/Api folder.
During this command execution, the Laravel application will be down (php artisan down
then php artisan up
at the end, called implicitly).
Composer dump autoloads will be called at the end.
app:makeApiModelResourceAssets
Only in development environment !
Generate and MODIFY basic assets source files for a new resource model in the dashboard :
- Resource model list vue component : Created in resources/assets/js/components/dashboard folder.
- Resource model item vue component : Created in resources/assets/js/components/dashboard folder.
- Resource model locales js files : Created in resources/assets/js/locales folder (one file per locale).
- Routes locales js files resources/assets/js/locales/en/routes.js and other locales file : MODIFY to add resource model list and item routes.
- Vuex store js file resources/assets/js/store.js : MODIFY to add resource model state, getters, mutations and actions.
- Routes js file resources/assets/js/routes.js : MODIFY to add resource model list and item routes.
- Side-bar menu vue component file resources/assets/js/components/includes/sidebar-menu.vue : MODIFY to add resource model links (interactive).
During this command execution, the Laravel application will be down (php artisan down
then php artisan up
at the end, called implicitly).
Make sure to run npm run dev
or npm run watch
to check your assets compilation.
(Upcoming upgrades to do : Model resource analysis to complete new components fields and other stuff like this.)
openApiSchemas:generate
This command is provided by the rygilles/laravel-openapi-schema-generator package.
It will analyze your laravel project files and generate a openapi json file, describing the capabilities of your Api.
Check the config/openapischemas.php configuration file before running this command.
Some information can not be retrieve automatically by the script, you might update/add data in the "openapi_bindings" configuration array.
ide-helper:generate
This command is provided by barryvdh/laravel-ide-helper package.
Only for development environment
This package generates a file that your IDE understands, so it can provide accurate autocompletion. Generation is done based on the files in your project, so they are always up-to-date. If you don't want to generate it, you can add a pre-generated file to the root folder of your Laravel project (but this isn't as up-to-date as self generated files).
All versions of laravel-api-boilerplate with dependencies
alsofronie/eloquent-uuid Version ^1.0
barryvdh/laravel-debugbar Version ^3.1
bugsnag/bugsnag-laravel Version ^2.0
dingo/api Version 2.0.0-alpha2
doctrine/dbal Version ^2.5
felixkiss/uniquewith-validator Version ^3.0
fideloper/proxy Version ~4.0
filp/whoops Version ^2.1
guzzlehttp/guzzle Version ^6.2
laravel/framework Version 5.6.*
laravel/passport Version ^6.0
laravel/tinker Version ~1.0
predis/predis Version ^1.1
rygilles/laravel-apidoc-generator Version 0.1.1
rygilles/laravel-openapi-schema-generator Version v0.3.3