RESTful API template made from Lumen 6 and extended by dingo/api.
Lumen |
---|
5.8 |
5.7 |
Clone/Download this repository place on your server. (I highly recommend you use either Laravel Homestead or Laravel Valet, to get the optimal server configuration and no errors through installation.)
This boilerplate comes with a .env.example
file in the root of the project.
Copy env.example
to .env
where you prepare your environment.
Note: Make sure you do not rename .env.example
, for team purposes.
Lumen has no php artisan key:generate
. You can research how to add APP_KEY in Lumen. search here
You can also try to run:
php -a # An interactive php shell
echo substr(md5(rand()), 0, 32); # Generating 32 character string
Lumen/Dingo boilerplate dependencies are managed through the PHP Composer tool. Install the depencencies by navigating into your project in terminal and typing this command:
composer install
After that run :
composer fresh
This will migrate tables, seed fake data to your database, and install laravel passport.
See composer.json
> scripts index
.
Login using OAuth2 by laravel/passport
Install laravel passport by navigating into your project in terminal and run this command:
php artisan passport:install
This will generate Client ID and Client Secret.
Use the Client ID
and Client Secret
of password grant for OAuth2 - Login (Password grant) endpoint.
Do not forget to add Headers
- Accept =
application/x.lumen.dingo.boilerplate.v1+json
(Depends on your API_SUBTYPE value in your environment ifapi strict
mode is enabled). - Content-Type =
application/x-www-form-urlencoded
.
You should run this command in your project directory first:
npm install apidoc -g
To generate the API documentation run this command:
php artisan apidocs
You can visit the generated API documentation in http://lumen-dingo-boilerplate.test/docs.
You can view integration here
In your project directory run this command:
First run this command to create database.sqlite
in database folder. this make testing database faster
composer db
Then run phpunit
vendor/bin/phpunit
Notes:
- If you running this via Homestead's ssh, you can this command:
phpunit
(in your project directory). - Run
composer coverage
to see code coverage viahtml
. - Run
composer coverage-txt
to see code coverage viaterminal
.
- laravel/lumen-framework - The stunningly fast micro-framework by Laravel.
- dingo/api - A RESTful API package for the Laravel and Lumen frameworks.
- spatie/laravel-cors - Send CORS headers in a Laravel application.
- thephpleague/fractal - Output complex, flexible, AJAX/RESTful data structures, extended by dingo/api
- laravel/passport - OAuth2 server and API authentication, fix installed by dusterio/lumen-passport.
- andersao/l5-repository - Repositories to abstract the database layer.
- spatie/laravel-permission - Associate users with roles and permissions.
- vinkla/laravel-hashids - A Hashids bridge for Laravel.
- apidoc/apidoc - RESTful web API Documentation Generator.
- rap2hpoutre/laravel-log-viewer - Laravel log viewer.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License.
- Log viewer
- Documentation private route with permission
- Localization
- Code Generator
- Seeder for Test/Production separately
- Manage seeder for permissions
- Include Postman collection/Config/Preset
- Wiki
- Firewall
- Social login