A starter for RESTful APIs built with the Lumen framework. This starter is meant to serve as a starting point for those building a lightweight API for their app.
Below are the frameworks and dependencies used to code the project.
| Dependency | Version |
|---|---|
| PHP | 7.1.3 & greater |
| Lumen | 5.7.* |
| guzzlehttp/guzzle | -- |
| fruitcake/laravel-cors | -- |
| flipbox/lumen-generator | -- |
| dusterio/lumen-passport | -- |
- Clone the repo:
git clone https://github.com/PeterKitonga/lumenstarterpassport.git - Go into project folder and run
composer installto install all dependencies - Create environment configurations file
cp .env.example .envand modify the mail, database, cache, file systems - Run
php artisan key:generateto get the app key cipher for encryption - Run migrations
php artisan migrate - Run
php artisan passport:installto generate the oauth keys for generating API tokens for authentication - Copy and paste the printed keys from your terminal to your env variables:
PERSONAL_ACCESS_CLIENT_IDandPERSONAL_ACCESS_CLIENT_SECRETwhich are the first two printed lines on the terminalPASSWORD_GRANT_CLIENT_IDandPASSWORD_GRANT_CLIENT_SECRETwhich are the last two printed lines on the terminal
- Run authentication seeders
php artisan db:seed --class=AuthTablesSeeder - In case you want some dummy users to play around with run
php artisan db:seed --class=UsersTableSeeder - Run other seeders
php artisan db:seed - If using the public driver as your
FILESYSTEM_DRIVER, then:-- create a directory named
publicunder/pathtoproject/storage/app/ - create symbolic link to
/pathtoproject/public/storagee.g.ln -s /var/www/php/lumenstarterpassport/storage/app/public/ /var/www/php/lumenstarterpassport/public/storage - add permissions
sudo chown -R :www-data storage/app/
- create a directory named
- Make sure to update the
APP_URLenv variable to the url of this lumen application. - In case you have a front end, don't forget to update the
WEB_CLIENT_URLenv variable to the URL of your front end - Run application
php artisan serve
Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.
Documentation for the framework can be found on the Lumen website.
If you discover a security vulnerability within Lumen, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Lumen framework is open-sourced software licensed under the MIT license