PHPackages                             cbxtechcorp/lumen-rest-api-template - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. cbxtechcorp/lumen-rest-api-template

ActiveProject[API Development](/categories/api)

cbxtechcorp/lumen-rest-api-template
===================================

Lumen Framework Rest API Boilerplate using JWT AUTH

418[1 PRs](https://github.com/marco-gallegos/lumen-rest-api-template/pulls)PHP

Since Apr 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/marco-gallegos/lumen-rest-api-template)[ Packagist](https://packagist.org/packages/cbxtechcorp/lumen-rest-api-template)[ RSS](/packages/cbxtechcorp-lumen-rest-api-template/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

Lumen API Template/Boilerplate with JWT Auth
============================================

[](#lumen-api-templateboilerplate-with-jwt-auth)

[![License](https://camo.githubusercontent.com/a464832aa7fc1f49feef7915b0f8d2aa4804738ec451b7820997d7523b517e3b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6172636f2d67616c6c65676f732f6c756d656e2d726573742d6170692d74656d706c6174653f7374796c653d666f722d7468652d6261646765)](http://opensource.org/licenses/MIT)[![PHP8](https://camo.githubusercontent.com/6ac02bc2c7e27d960ef87ac90d7188d95d5991365208020469f5d5893bd6a82c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c75653f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/6ac02bc2c7e27d960ef87ac90d7188d95d5991365208020469f5d5893bd6a82c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c75653f7374796c653d666f722d7468652d6261646765)[![LUMEN8.X](https://camo.githubusercontent.com/536738d3d7a2c9e2b5bb34d7a088c3502af76057be3b337a84a00d765f8b23e7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c554d454e2d382e582d6f72616e67653f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/536738d3d7a2c9e2b5bb34d7a088c3502af76057be3b337a84a00d765f8b23e7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c554d454e2d382e582d6f72616e67653f7374796c653d666f722d7468652d6261646765)

This is a boilerplate for lumen 8.x if you are using lumen to write REST api it will help you.

This project use:

- [dingo/api](https://github.com/dingo/api)
- [tymon/jwt-auth](https://github.com/tymondesigns/jwt-auth)
- [palanik/lumen-cors](https://github.com/palanik/lumen-cors)
- [flipboxstudio/lumen-generator](https://github.com/flipboxstudio/lumen-generator)

Write some easy APIs.

Checkout 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)

Feel free to make a pull request and make this repo better :D

TODO
----

[](#todo)

- docker
- phpunit validation

Main Features
-------------

[](#main-features)

### Document your API

[](#document-your-api)

```
apidoc -i App/Http/Controller/Api/v1 -o public/apidoc
```

### Use Artisan Generators

[](#use-artisan-generators)

By 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.

Test:

```
php artisan make:model MyModel
```

USEFUL LINKS
------------

[](#useful-links)

- dingo/api
- json-web-token(jwt)
- transformer [fractal](http://fractal.thephpleague.com/)
- apidoc [apidocjs](http://apidocjs.com/)
- Rest API guidance [jsonapi.org](http://jsonapi.org/format/)
- Rest API Debug [Insomnia](https://insomnia.rest/)
- A good article [http://oomusou.io/laravel/laravel-architecture](http://oomusou.io/laravel/laravel-architecture/)

Installation
------------

[](#installation)

### 1 Install the project

[](#1-install-the-project)

#### Using GIT

[](#using-git)

```
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
```

#### Using Composer

[](#using-composer)

```
composer create-project --stability dev cbxtechcorp/lumen-rest-api-template new_api
```

### 2 configre your project

[](#2-configre-your-project)

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
```

Documentation
-------------

[](#documentation)

### Serve Your API

[](#serve-your-api)

```
php artisan serve
# or
php -S localhost:8000 -t public
```

### Deploy

[](#deploy)

In a production server we can omit development packages autoload using this command

```
composer install --no-dev
```

### Routes

[](#routes)

We have some routes to start.

- api/v1/users
- api/v1/permission

FAQ
---

[](#faq)

 About JWTThere is no session and auth guard in lumen 5.2, so attention `config/auth.php`. Also user model must implement `Tymon\JWTAuth\Contracts\JWTSubject`

 How to use mail- composer require `illuminate/mail` and `guzzlehttp/guzzle`
- register email service in `bootstrap/app.php` or `some provider`
- add `mail.php` `services.php` in config, just copy them from laravel
- add `MAIL_DRIVER` in env

 How to use transformer transformer is a layer help you format you resource and their relationship.

maybe you can knowstand with this links:

-
-
-
-
-
-

 transformer data serizlizer dingo/api use [Fractal](http://fractal.thephpleague.com/) to transformer resouses，fractal provider 3 serializer,Array,DataArray,JsonApi.more details at here 。DataArray is default.You can set your own serizlizer like this：

see bootstrap/app.php $app\['Dingo\\Api\\Transformer\\Factory'\]-&gt;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-&gt;setSerializer($serializer);, return new Dingo\\Api\\Transformer\\Adapter\\Fractal($fractal); });

I think default DataArray is good enough.

Check the Original Project
--------------------------

[](#check-the-original-project)

[Lumen API Demo](https://github.com/liyu001989/lumen-api-demo)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 82.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b113f402f8eb89ac31f19a23bacc08e1c61050995e183c377e850d4ced0dd26b?d=identicon)[cebox616](/maintainers/cebox616)

---

Top Contributors

[![liyu001989](https://avatars.githubusercontent.com/u/2981799?v=4)](https://github.com/liyu001989 "liyu001989 (276 commits)")[![marco-gallegos](https://avatars.githubusercontent.com/u/6290032?v=4)](https://github.com/marco-gallegos "marco-gallegos (54 commits)")[![stenote](https://avatars.githubusercontent.com/u/1109648?v=4)](https://github.com/stenote "stenote (2 commits)")[![erisitohang](https://avatars.githubusercontent.com/u/196479?v=4)](https://github.com/erisitohang "erisitohang (1 commits)")[![gallem](https://avatars.githubusercontent.com/u/37949370?v=4)](https://github.com/gallem "gallem (1 commits)")[![oukan](https://avatars.githubusercontent.com/u/1324257?v=4)](https://github.com/oukan "oukan (1 commits)")

---

Tags

apiapi-templateboilerplatelaravellaravel-frameworklaravel-templatelumenlumen-frameworkphpphp-templatephp7restrest-apirest-templaterestapitemplate

### Embed Badge

![Health badge](/badges/cbxtechcorp-lumen-rest-api-template/health.svg)

```
[![Health](https://phpackages.com/badges/cbxtechcorp-lumen-rest-api-template/health.svg)](https://phpackages.com/packages/cbxtechcorp-lumen-rest-api-template)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M478](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M271](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
