PHPackages                             desmart/jwt-auth - 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. desmart/jwt-auth

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

desmart/jwt-auth
================

Simple JWT auth implementation for Laravel.

1.0.4(8y ago)02.1kMITPHPPHP &gt;=7.0.0

Since Nov 12Pushed 8y ago4 watchersCompare

[ Source](https://github.com/DeSmart/jwt-auth)[ Packagist](https://packagist.org/packages/desmart/jwt-auth)[ RSS](/packages/desmart-jwt-auth/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (6)Versions (9)Used By (0)

Laravel JWT Auth
================

[](#laravel-jwt-auth)

Simple JWT auth implementation for Laravel.

---

### Installation

[](#installation)

Install package using Composer:

```
composer require desmart/jwt-auth

```

Register the package's service provider in `config/app.php`:

```
'providers' => [
        (...)
        DeSmart\JWTAuth\ServiceProvider::class,
    ],

```

### Configuration

[](#configuration)

The package comes with a config file. In order to publish it, run the following command:

```
php artisan vendor:publish

```

The config file allows you to change some options. Be sure to check it out.

### Usage

[](#usage)

The package allows to:

1. Authenticate a user,
2. Verify if the user is authenticated using route middleware.

### User authentication

[](#user-authentication)

First, add the `TokenRefreshMiddleware` as a global middleware or to a middleware group (`app/Http/Kernel.php`). It will add the `Authorization` header to the response. This header will contain the JWT token, after successful authentication.

Then, inject `\DeSmart\JWTAuth\Auth\Guard` into your auth class and authenticate the user (credentials validation is up to you).

```
public function authenticateUser(\DeSmart\JWTAuth\Auth\Guard $auth, $user) {
    if (true === $this->validateCredentails($user)) {
        $auth->loginUser($user);
    }
}

```

### Token verification

[](#token-verification)

Once a user has been authenticated, each request to your application should contain the `Authorization` header with the token obtained after succesful authentication.

Add `AuthMiddleware` to the your `$routeMiddleware` array (`app/Http/Kernel.php`):

```
protected $routeMiddleware = [
        (...)
        'auth' => \DeSmart\JWTAuth\Middleware\AuthMiddleware::class,
    ];

```

Now, simply use the `auth` route middleware to check if a user is authenticated.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

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 ~53 days

Recently: every ~71 days

Total

8

Last Release

3141d ago

Major Versions

0.2.1 → 1.0.02017-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/92bc27fc8f1cba837cef419eee0fae358f52c804cd5450cf994f9095fa387a5c?d=identicon)[DeSmart](/maintainers/DeSmart)

---

Top Contributors

[![muberman](https://avatars.githubusercontent.com/u/5789184?v=4)](https://github.com/muberman "muberman (4 commits)")[![fojuth](https://avatars.githubusercontent.com/u/2622146?v=4)](https://github.com/fojuth "fojuth (1 commits)")[![frankmichel](https://avatars.githubusercontent.com/u/236225?v=4)](https://github.com/frankmichel "frankmichel (1 commits)")[![radmen](https://avatars.githubusercontent.com/u/1190255?v=4)](https://github.com/radmen "radmen (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/desmart-jwt-auth/health.svg)

```
[![Health](https://phpackages.com/badges/desmart-jwt-auth/health.svg)](https://phpackages.com/packages/desmart-jwt-auth)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k17](/packages/fleetbase-core-api)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6783.6k5](/packages/hasinhayder-tyro)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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