The Manual way

Let's install the package as mentioned on the installation page at https://github.com/tymondesigns/jwt-auth/wiki/Installation.

First of all, we need to install the JWT Auth package:

 composer require tymon/jwt-auth 1.0.0-beta.3

Note that this version is for Laravel 5.3. For older versions, you might need to use a different version of the JWT Auth package, most probably version 0.5.

To register the service provider in the bootstrap/app.php file, add this line of code:

$app->register(Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class);

Then, add these two class aliases in the same bootstrap/app.php file:

class_alias('Tymon\JWTAuth\Facades\JWTAuth', 'JWTAuth');class_alias('Tymon\JWTAuth\Facades\JWTFactory', 'JWTFactory');

Get Building RESTful Web Services with PHP 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.