| Package Data | |
|---|---|
| Maintainer Username: | cebox616 | 
| Package Create Date: | 2020-04-20 | 
| Package Last Update: | 2023-02-02 | 
| Home Page: | |
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-27 03:18:29 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 18 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 4 | 
| Total Watchers: | 1 | 
| Total Forks: | 0 | 
| Total Open Issues: | 1 | 
This is a boilerplate for lumen 6.x if you are using lumen to write REST api it will help you.
This project use:
Write some easy APIs.
Checkout my other repo that is focused on reply to this template but using graphql lumen-graphql-api-template
Feel free to make a pull request and make this repo better :D
if you'r using composer v1.x check this project
# instalar el plugin
composer global require hirak/prestissimo
apidoc -i App/Http/Controller/Api/v1 -o public/apidoc
Not natively supported by lumen, we can list all our routes via api:route command
php artisan api:route
By default lumen does't support the useful laravel/artisan generators and using this extension we can use this comands executing a "dev inclusive" composer install.
Test:
php artisan make:model MyModel
git clone https://github.com/marco-gallegos/lumen-rest-api-template.git new_api
cd new_api
composer install
cp .env.example .env
php artisan jwt:secret
composer create-project --stability=dev cbxtechcorp/lumen-rest-api-template new_api
Now give to your project access tou your database and create the users table whit a test user.
vim .env
  DB_*
    configure your database access
  
  APP_KEY
    key:generate is abandoned in lumen, so do it yourself
    md5(uniqid()),str_random(32) etc.,maybe use jwt:secret and copy it
php artisan migrate --seed
php -S localhost:8000 -t public
# or
php artisan serve
In a production server we can omit development packages autoload using this command
composer install --no-dev
We have some routes to start.
The login route returns access token to make any other request.
route : http://your.domain/api/v1/authorizations
type : post
parameters : {
email: "yourmail@some.com",
password: "userpassword"
}
There is no session and auth guard in lumen 5.2, so attention config/auth.php. Also user model must implement Tymon\JWTAuth\Contracts\JWTSubject
illuminate/mail and guzzlehttp/guzzle
bootstrap/app.php or some provider
mail.php services.php in config, just copy them from laravelMAIL_DRIVER in envtransformer is a layer help you format you resource and their relationship.
maybe you can knowstand with this links:
dingo/api use Fractal to transformer resouses,fractal provider 3 serializer,Array,DataArray,JsonApi.more details at here http://fractal.thephpleague.com/serializers/。DataArray is default.You can set your own serizlizer like this:
see bootstrap/app.php $app['Dingo\Api\Transformer\Factory']->setAdapter(function ($app) { $fractal = new League\Fractal\Manager; // $serializer = new League\Fractal\Serializer\JsonApiSerializer(); $serializer = new League\Fractal\Serializer\ArraySerializer(); // $serializer = new App\Serializers\NoDataArraySerializer(); $fractal->setSerializer($serializer);, return new Dingo\Api\Transformer\Adapter\Fractal($fractal); });
I think default DataArray is good enough.