A RESTful API boilerplate for lumen 5.7. Features included:
- Users Resource
- OAuth2 Authentication using JWT Auth
- Scope based Authorization
- Validation
- Pagination
- Event Handling
- Sending Mail using Mailable class
- Endpoint Tests
- composer
- php(version>=7.2)
- mysql
$ composer create-project laravel/lumen rest_api
$ composer require tymon/jwt-auth
// Uncomment this line
$app->register(App\Providers\AuthServiceProvider::class);
// Add this line
$app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class);
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
]);
php artisan jwt:secret
use Tymon\JWTAuth\Contracts\JWTSubject
https://github.com/tymondesigns/jwt-auth
HTTP Method | Path | Action | Scope | Desciption |
---|---|---|---|---|
GET | /users | index | users:list | Get all users |
POST | /users | store | users:create | Create an user |
GET | /users/{user} | show | users:read | Fetch an user by id |
PUT | /users/{user} | update | users:write | Update an user by id |
DELETE | /users/{user} | destroy | users:delete | Delete an user by id |
Note: users/me
is a special route for getting current authenticated user.
And for all User routes 'users' scope is available if you want to perform all actions.