PHPackages                             tlx3/laravel-jwt-starter - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. tlx3/laravel-jwt-starter

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

tlx3/laravel-jwt-starter
========================

Boilerplate for using your own API based JWT authentication on Laravel applications

1.1(8y ago)3305[1 issues](https://github.com/TLX3/laravel-jwt-starter/issues)MITPHP

Since Aug 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/TLX3/laravel-jwt-starter)[ Packagist](https://packagist.org/packages/tlx3/laravel-jwt-starter)[ Docs](https://github.com/TLX3/laravel-jwt-starter)[ RSS](/packages/tlx3-laravel-jwt-starter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

laravel-jwt-starter
===================

[](#laravel-jwt-starter)

In a microservice oriented architecture, a client component will communicate with set of microservices where interactions need to be authenticated and authorized. Usually, the users of these microservices will authenticate using the same API in this system. Often, the creation of a login page and authentication middleware will need to be replicated in each of these microservices.

Given a Laravel application, this package will create a generic login with relevant jwt middleware to authenticate the user into your authentication API. This Laravel boilerplate can be added to an existing or new project with minimal configuration. It publishes the respective views, css, and middleware into your project. These can be configured to your needs.

### Installation

[](#installation)

To install this package you will need:

- Laravel 5
- PHP 5.4 +

Run `composer require tlx3/laravel-jwt-starter`Register this package's Service Provider by adding it to the `providers`section of your `config/app.php` file:

```
   'providers' => [
       // ... other providers omitted
       TLX3\LaravelJWTStarter\LaravelJWTStarterServiceProvider::class,
   ],
```

Then to publish the necessary middleware, views, and css:

```
php artisan vendor:publish
or
php artisan vendor:publish  --provider="TLX3\LaravelJWTStarter\LaravelJWTStarterServiceProvider"

```

Also, you will need to install these packages

- Forms &amp; HTML - [laravelcollective/html](https://laravelcollective.com/docs/master/html)
    - `composer require "laravelcollective/html"`
    - Update service providers and aliases in `config/app.php` file
    - ```
        'providers' => [
             // ...
             Collective\Html\HtmlServiceProvider::class,
             // ...
         ],
         ...
         'aliases' => [
             // ...
             'Form' => Collective\Html\FormFacade::class,
             'Html' => Collective\Html\HtmlFacade::class,
             // ...
         ],
        ```
- PHP-JWT - [firebase/php-jwt](https://github.com/firebase/php-jwt)
    - `composer require firebase/php-jwt`
- Guzzle - [guzzlehttp/guzzle](http://docs.guzzlephp.org/en/stable/overview.html#installation)
    - `composer require guzzlehttp/guzzle`

This project integrates these three packages for a form builder, token decoder, and HTTP Client. These packages have numerous features that will help with development over time by reducing overhead.

#### 1) Environment variables

[](#1-environment-variables)

Set your authentication API endpoint, JWT secret, and successful login response code in your `.env` file, you can add/remove to fit your requirements in auth:

```
AUTH_URL=
JWT_SECRET=
STATUS_CODE=

```

#### 2) Middleware

[](#2-middleware)

Update $routeMiddleware in `app/Http/Middleware/kernel.php` file with the additional middleware added. You should modify these along with the login.blade.php view to fit your application logic:

```
    protected $routeMiddleware = [
        // ... other middleware omitted
        'checkToken' => \App\Http\Middleware\CheckToken::class,
        'notLoggedIn' => \App\Http\Middleware\NotLoggedIn::class,
        'logout' => \App\Http\Middleware\Logout::class,
        'login' => \App\Http\Middleware\Login::class,
    ];
```

#### 3) Routes

[](#3-routes)

Update `routes/web.php` with these routes. You can modify and change these routes to fit your project, I've added a filler home page as a landing page after logging in:

```
    Route::get('login', function () {
        return view('login');
    })->middleware('notLoggedIn');

    Route::post('authenticate', function () {
        return View::make('home');
    })->middleware('login');

    // routes that require user to have been authenticated
    Route::group(['middleware' => 'checkToken'], function () {
        Route::get('home', function () {
            return View::make('home');
        });

        Route::get('logout', function () {
            return View::make('login');
        })->middleware('logout');
    });
```

#### 4) Usage

[](#4-usage)

After installation you can now go to `/login` and attempt to login and access protected routes as set prior. Alongside the routes, you will probably want to modify both `views/login.blade.php` and `app/Http/Middleware/Login.php` to fit your application logic. The authentication inputs are set here along with the .env variables names that you can customize. You should also modify Login and CheckToken middleware to decode the token for neccessary payload items if needed.

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity64

Established project with proven stability

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3199d ago

### Community

Maintainers

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

---

Tags

jwtlogin

### Embed Badge

![Health badge](/badges/tlx3-laravel-jwt-starter/health.svg)

```
[![Health](https://phpackages.com/badges/tlx3-laravel-jwt-starter/health.svg)](https://phpackages.com/packages/tlx3-laravel-jwt-starter)
```

###  Alternatives

[firebase/php-jwt

A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.

9.8k445.7M2.1k](/packages/firebase-php-jwt)[lcobucci/jwt

A simple library to work with JSON Web Token and JSON Web Signature

7.5k316.6M895](/packages/lcobucci-jwt)[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40820.2M68](/packages/auth0-auth0-php)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.0M3](/packages/auth0-login)

PHPackages © 2026

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