2017 © Pedro Peláez
 

project laravel-api-jwt-starter

Laravel API boilerplate with jwt authentication

image

jafar690/laravel-api-jwt-starter

Laravel API boilerplate with jwt authentication

  • Sunday, July 9, 2017
  • by jafar690
  • Repository
  • 1 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

, (*1)

Laravel API JWT Starter

Laravel API JWT Starter is a "starter kit" you can use to build your first API in seconds. It is based on larave 5.4!, (*2)

It is built on top of three packages:, (*3)

What I made is an integration of these three packages and a setup of some authentication and credentials recovery methods., (*4)

Installation

  1. run composer create-project jafar690/laravel-api-jwt-starter yourProjectName;
  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., (*5)

Main Features

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\Http\Controllers\Auth\ for those operations., (*6)

For each controller there's an already setup route in routes/api.php file:, (*7)

  • POST api/auth/login, to do the login and get your access token;
  • POST api/auth/register, 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;

A Separate File for Routes

All the API routes can be found in the routes/api.php file. This also follow the Laravel 5.3 convention., (*8)

On create project commands

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

Configuration

This boilerplate is based on dingo/api and tymondesigns/jwt-auth packages. So, you can find many informations about configuration here and here., (*10)

I have made some minor changes to the DINGO API configuration file in config/api.php, (*11)

  • sign_up.release_token: set it to true if you want your app release the token right after the sign up process;
  • reset_password.release_token: set it to true if you want your app release the token right after the password reset process;

I have also created form requests for every action (login, register, recovery and reset). Feel free to customize it for your needs., (*12)

Creating Endpoints

You can create endpoints in the same way you could to with using the single dingo/api package. You can read its documentation for details. After all, that's just a boilerplate! :), (*13)

However, I added some example routes to the routes/api.php file to give you immediately an idea., (*14)

Cross Origin Resource Sharing

If you want to enable CORS for a specific route or routes group, you just have to use the cors middleware on them., (*15)

Thanks to the barryvdh/laravel-cors package, you can handle CORS easily. Just check the docs at this page for more info., (*16)

Feedback

For any questions or feedback, feel free to send me an email at kgakami690@gmail.com, (*17)

The Versions

09/07 2017

dev-master

9999999-dev

Laravel API boilerplate with jwt authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api boilerplate jwt