PHPackages                             francescomalatesta/laravel-api-boilerplate-jwt - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. francescomalatesta/laravel-api-boilerplate-jwt

ActiveProject[HTTP &amp; Networking](/categories/http)

francescomalatesta/laravel-api-boilerplate-jwt
==============================================

An API Boilerplate to create a ready-to-use REST API in seconds.

5.8.2(7y ago)1.2k7.5k281[5 issues](https://github.com/francescomalatesta/laravel-api-boilerplate-jwt/issues)MITPHPPHP &gt;=7.1.3

Since Jul 25Pushed 6y ago68 watchersCompare

[ Source](https://github.com/francescomalatesta/laravel-api-boilerplate-jwt)[ Packagist](https://packagist.org/packages/francescomalatesta/laravel-api-boilerplate-jwt)[ RSS](/packages/francescomalatesta-laravel-api-boilerplate-jwt/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (11)Versions (14)Used By (0)

Laravel API Boilerplate (JWT Edition) for Laravel 5.8
-----------------------------------------------------

[](#laravel-api-boilerplate-jwt-edition-for-laravel-58)

[![Build Status](https://camo.githubusercontent.com/3f10fec960a5e7957467056c73ad4225ec16e695f1d5ffd22cc39f3f123a1f70/68747470733a2f2f7472617669732d63692e6f72672f6672616e636573636f6d616c6174657374612f6c61726176656c2d6170692d626f696c6572706c6174652d6a77742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/francescomalatesta/laravel-api-boilerplate-jwt)

Laravel API Boilerplate is a "starter kit" you can use to build your first API in seconds. As you can easily imagine, it is built on top of the awesome Laravel Framework. This version is built on Laravel 5.8!

It is built on top of three big guys:

- JWT-Auth - [tymondesigns/jwt-auth](https://github.com/tymondesigns/jwt-auth)
- Dingo API - [dingo/api](https://github.com/dingo/api)
- Laravel-CORS [barryvdh/laravel-cors](http://github.com/barryvdh/laravel-cors)

What I made is really simple: an integration of these three packages and a setup of some authentication and credentials recovery methods.

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

[](#installation)

1. run `composer create-project francescomalatesta/laravel-api-boilerplate-jwt myNextProject`;
2. have a coffee, nothing to do here;

Once the project creation procedure will be completed, run the `php artisan migrate` command to install the required tables.

Usage
-----

[](#usage)

I wrote a couple of articles on this project that explain how to write an entire sample application with this boilerplate. They cover the older version of this boilerplate, but all the concepts are the same. You can find them on Sitepoint:

Just be aware that some options in the `config/boilerplate.php` file are changed, so take a look to it.

- [How to Build an API-Only JWT-Powered Laravel App](https://www.sitepoint.com/how-to-build-an-api-only-jwt-powered-laravel-app/)
- [How to Consume Laravel API with AngularJS](https://www.sitepoint.com/how-to-consume-laravel-api-with-angularjs/)

**WARNING:** the articles are old and Laravel 5.1 related. Just use them as "inspiration". Even without updated tutorials, they should be enough.

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

[](#main-features)

### Ready-To-Use Authentication Controllers

[](#ready-to-use-authentication-controllers)

You don't have to worry about authentication and password recovery anymore. I created four controllers you can find in the `App\Api\V1\Controllers` for those operations.

For each controller there's an already setup route in `routes/api.php` file:

- `POST api/auth/login`, to do the login and get your access token;
- `POST api/auth/refresh`, to refresh an existent access token by getting a new one;
- `POST api/auth/signup`, to create a new user into your application;
- `POST api/auth/recovery`, to recover your credentials;
- `POST api/auth/reset`, to reset your password after the recovery;
- `POST api/auth/logout`, to log out the user by invalidating the passed token;
- `GET api/auth/me`, to get current user data;

### Separate File for Routes

[](#separate-file-for-routes)

All the API routes can be found in the `routes/api.php` file. This also follow the Laravel 5.5 convention.

### Secrets Generation

[](#secrets-generation)

Every time you create a new project starting from this repository, the *php artisan jwt:generate* command will be executed.

Configuration
-------------

[](#configuration)

You can find all the boilerplate specific settings in the `config/boilerplate.php` config file.

```
