{"id":14975314,"url":"https://github.com/marco-gallegos/lumen-rest-api-template","last_synced_at":"2025-10-27T13:30:37.194Z","repository":{"id":44831132,"uuid":"257186555","full_name":"marco-gallegos/lumen-rest-api-template","owner":"marco-gallegos","description":"Template / Boilerplate To Build Rest API's with Lumen 6","archived":false,"fork":false,"pushed_at":"2023-02-02T00:57:30.000Z","size":1398,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T05:41:17.905Z","etag":null,"topics":["api","api-template","boilerplate","laravel","laravel-framework","laravel-template","lumen","lumen-framework","php","php-template","php7","rest","rest-api","rest-template","restapi","template"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marco-gallegos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-20T06:03:22.000Z","updated_at":"2022-10-19T11:25:38.000Z","dependencies_parsed_at":"2023-02-17T13:00:41.615Z","dependency_job_id":null,"html_url":"https://github.com/marco-gallegos/lumen-rest-api-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-gallegos%2Flumen-rest-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-gallegos%2Flumen-rest-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-gallegos%2Flumen-rest-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marco-gallegos%2Flumen-rest-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marco-gallegos","download_url":"https://codeload.github.com/marco-gallegos/lumen-rest-api-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238497670,"owners_count":19482296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-template","boilerplate","laravel","laravel-framework","laravel-template","lumen","lumen-framework","php","php-template","php7","rest","rest-api","rest-template","restapi","template"],"created_at":"2024-09-24T13:51:51.539Z","updated_at":"2025-10-27T13:30:31.832Z","avatar_url":"https://github.com/marco-gallegos.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lumen API Template/Boilerplate with JWT Auth\r\n\r\n[![License](https://img.shields.io/github/license/marco-gallegos/lumen-rest-api-template?style=for-the-badge)](http://opensource.org/licenses/MIT)\r\n![PHP8](https://img.shields.io/badge/PHP-8-blue?style=for-the-badge)\r\n![LUMEN8.X](https://img.shields.io/badge/LUMEN-8.X-orange?style=for-the-badge)\r\n\r\n\r\nThis is a boilerplate for lumen 8.x if you are using lumen to write REST api it will help you.\r\n\r\nThis project use:\r\n\r\n* [dingo/api](https://github.com/dingo/api)\r\n* [tymon/jwt-auth](https://github.com/tymondesigns/jwt-auth)\r\n* [palanik/lumen-cors](https://github.com/palanik/lumen-cors)\r\n* [flipboxstudio/lumen-generator](https://github.com/flipboxstudio/lumen-generator)\r\n\r\n\r\nWrite some easy APIs.\r\n\r\nCheckout my other repo that is focused on reply to this template but using graphql [lumen-graphql-api-template](https://github.com/marco-gallegos/lumen-graphql-api-template)\r\n\r\nFeel free to make a pull request and make this repo better :D\r\n\r\n## TODO\r\n\r\n- [ ] docker\r\n- [ ] phpunit validation\r\n\r\n## Main Features\r\n\r\n### Document your API\r\n\r\n```bash\r\napidoc -i App/Http/Controller/Api/v1 -o public/apidoc\r\n```\r\n\r\n### Use Artisan Generators\r\n\r\nBy default lumen does't support the useful laravel/artisan generators and using [this extension](https://github.com/flipboxstudio/lumen-generator) we can use this comands executing a \"dev inclusive\" composer install.\r\n\r\n\r\nTest:\r\n\r\n```bash\r\nphp artisan make:model MyModel\r\n```\r\n\r\n### \r\n\r\n## USEFUL LINKS\r\n\r\n- dingo/api [https://github.com/dingo/api](https://github.com/dingo/api)\r\n- json-web-token(jwt) [https://github.com/tymondesigns/jwt-auth](https://github.com/tymondesigns/jwt-auth)\r\n- transformer [fractal](http://fractal.thephpleague.com/)\r\n- apidoc [apidocjs](http://apidocjs.com/)\r\n- Rest API guidance [jsonapi.org](http://jsonapi.org/format/)\r\n- Rest API Debug [Insomnia](https://insomnia.rest/)\r\n- A good article [http://oomusou.io/laravel/laravel-architecture](http://oomusou.io/laravel/laravel-architecture/)\r\n\r\n## Installation\r\n\r\n### 1 Install the project\r\n\r\n#### Using GIT\r\n\r\n``` bash\r\ngit clone https://github.com/marco-gallegos/lumen-rest-api-template.git new_api\r\ncd new_api\r\ncomposer install\r\ncp .env.example .env\r\nphp artisan jwt:secret\r\n```\r\n\r\n#### Using Composer\r\n\r\n```bash\r\ncomposer create-project --stability dev cbxtechcorp/lumen-rest-api-template new_api\r\n```\r\n\r\n### 2 configre your project\r\n\r\nNow give to your project access tou your database and create the users table whit a test user.\r\n\r\n```bash\r\nvim .env\r\n  DB_*\r\n    configure your database access\r\n  \r\n  APP_KEY\r\n    key:generate is abandoned in lumen, so do it yourself\r\n    md5(uniqid())，str_random(32) etc.，maybe use jwt:secret and copy it\r\n\r\nphp artisan migrate --seed\r\n```\r\n\r\n## Documentation\r\n\r\n### Serve Your API\r\n\r\n```bash\r\nphp artisan serve\r\n# or\r\nphp -S localhost:8000 -t public\r\n```\r\n\r\n### Deploy\r\n\r\nIn a production server we can omit development packages autoload using this command\r\n\r\n```bash\r\ncomposer install --no-dev\r\n```\r\n\r\n### Routes\r\n\r\nWe have some routes to start.\r\n\r\n- api/v1/users\r\n- api/v1/permission\r\n\r\n## FAQ\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003eAbout JWT\u003c/summary\u003e\r\n\r\n  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`\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003eHow to use mail\u003c/summary\u003e\r\n\r\n- composer require `illuminate/mail` and `guzzlehttp/guzzle`\r\n- register email service in `bootstrap/app.php` or `some provider`\r\n- add `mail.php` `services.php` in config, just copy them from laravel\r\n- add `MAIL_DRIVER` in env\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003eHow to use transformer \u003c/summary\u003e\r\n\r\n  transformer is a layer help you format you resource and their relationship.\r\n\r\n  maybe you can knowstand with this links:\r\n\r\n- [https://lumen-new.lyyw.info/api/posts](https://lumen-new.lyyw.info/api/posts)\r\n- [https://lumen-new.lyyw.info/api/posts?include=user](https://lumen-new.lyyw.info/api/posts?include=user)\r\n- [https://lumen-new.lyyw.info/api/posts?include=user,comments](https://lumen-new.lyyw.info/api/posts?include=user,comments)\r\n- [https://lumen-new.lyyw.info/api/posts?include=user,comments:limit(1)](https://lumen-new.lyyw.info/api/posts?include=user,comments:limit(1))\r\n- [https://lumen-new.lyyw.info/api/posts?include=user,comments.user](https://lumen-new.lyyw.info/api/posts?include=user,comments.user)\r\n- [https://lumen-new.lyyw.info/api/posts?include=user,comments:limit(1),comments.user](https://lumen-new.lyyw.info/api/posts?include=user,comments:limit(1),comments.user)\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003etransformer data serizlizer \u003c/summary\u003e\r\n\r\n  dingo/api use [Fractal](http://fractal.thephpleague.com/) to transformer resouses，fractal provider 3 serializer,Array,DataArray,JsonApi.more details at here [http://fractal.thephpleague.com/serializers/](http://fractal.thephpleague.com/serializers/)。DataArray is default.You can set your own serizlizer like this：\r\n\r\n  see bootstrap/app.php\r\n  $app['Dingo\\Api\\Transformer\\Factory']-\u003esetAdapter(function ($app) {\r\n    $fractal = new League\\Fractal\\Manager;\r\n    // $serializer = new League\\Fractal\\Serializer\\JsonApiSerializer();\r\n    $serializer = new League\\Fractal\\Serializer\\ArraySerializer();\r\n    // $serializer = new App\\Serializers\\NoDataArraySerializer();\r\n    $fractal-\u003esetSerializer($serializer);,\r\n    return new Dingo\\Api\\Transformer\\Adapter\\Fractal($fractal);\r\n  });\r\n\r\n  I think default DataArray is good enough.\r\n\u003c/details\u003e\r\n\r\n## Check the Original Project\r\n\r\n[Lumen API Demo](https://github.com/liyu001989/lumen-api-demo)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarco-gallegos%2Flumen-rest-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarco-gallegos%2Flumen-rest-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarco-gallegos%2Flumen-rest-api-template/lists"}