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

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

zendrop/laravel-jwt
===================

v2.14(1y ago)2111.5k↓74.4%MITPHPCI passing

Since Oct 11Pushed 1y ago4 watchersCompare

[ Source](https://github.com/12thbean/jwt)[ Packagist](https://packagist.org/packages/zendrop/laravel-jwt)[ RSS](/packages/zendrop-laravel-jwt/feed)WikiDiscussions main Synced yesterday

READMEChangelog (7)Dependencies (6)Versions (25)Used By (0)

Laravel JWT Guard
=================

[](#laravel-jwt-guard)

This package provides a simple way to use JWT (JSON Web Tokens) as an authentication guard in a Laravel application.

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

[](#installation)

Require package `zendrop/laravel-jwt`

```
composer require zendrop/laravel-jwt
```

Setup
-----

[](#setup)

After installation, you need to add service provider to your `config/app.php`

```
'providers' => [
    ...
    Zendrop\LaravelJwt\LaravelJwtAuthServiceProvider::class,
]
```

and publish the package configuration with command

```
php artisan vendor:publish
```

Don't forget to run migrations

```
php artisan migrate
```

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

[](#configuration)

Modify the generated `config/laravel-jwt.php` in the config folder to suit your needs:

1. Algorithm: Set the JWT algorithm you wish to use (default is HS256).
2. Keys: Specify the encode and decode keys. By default, it uses the APP\_KEY from your Laravel .env file.
3. Payload: Configure issuer (iss) and time-to-live (ttl) for the JWT.
4. Blacklist Driver: Specify the driver used for handling blacklisted tokens (default is a database driver).

Usage
-----

[](#usage)

### HasJwt Trait

[](#hasjwt-trait)

Include the `HasJwt` trait in your User model or any other authenticatable model:

```
use Zendrop\LaravelJwt\HasJwt;

class User extends Authenticatable {
    use HasJwt;
    ...
}
```

This provides the `makeJwt()` method to generate JWT for the user.

### JWT Guard

[](#jwt-guard)

In your `auth.php` config file, you can define the JWT guard:

```
'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
        ...
    ],
    'api' => [
        'driver' => 'laravel-jwt', // Use the JWT guard
        'provider' => 'users',
    ],
    ...
]
```

For stateful JWT:

```
'guards' => [
    'web' => [
        'driver' => 'laravel-jwt-cookie',
        'provider' => 'users',
    ],
]
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance43

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~30 days

Recently: every ~107 days

Total

19

Last Release

448d ago

Major Versions

v1.3 → v2.02023-11-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/98d4d5fe5bc71f7d5060bb447e50264d54774e3d9d380c3aa5ea502a3fbb9fe4?d=identicon)[Slauta](/maintainers/Slauta)

![](https://www.gravatar.com/avatar/48b5d9ece0bfb01bcfdc274b7fd27cacd3233c9cde71a2ddd4e1d4fcdc024d9a?d=identicon)[underwear](/maintainers/underwear)

![](https://www.gravatar.com/avatar/22c871e065a0278ffe09e34772ef7055fcb6313b051bccbcf400355a2f4879ce?d=identicon)[imelectronick](/maintainers/imelectronick)

![](https://www.gravatar.com/avatar/7e08b47adbdfd91df45b976881637146ff6fab186814dee742321153cd89b72a?d=identicon)[ArtemZhorov](/maintainers/ArtemZhorov)

---

Top Contributors

[![underwear](https://avatars.githubusercontent.com/u/4825406?v=4)](https://github.com/underwear "underwear (24 commits)")[![MrNubOK](https://avatars.githubusercontent.com/u/52452096?v=4)](https://github.com/MrNubOK "MrNubOK (3 commits)")[![ArtemZhorov](https://avatars.githubusercontent.com/u/93640734?v=4)](https://github.com/ArtemZhorov "ArtemZhorov (2 commits)")[![gor0utine](https://avatars.githubusercontent.com/u/993569?v=4)](https://github.com/gor0utine "gor0utine (1 commits)")[![imelectronick](https://avatars.githubusercontent.com/u/1112297?v=4)](https://github.com/imelectronick "imelectronick (1 commits)")[![Slauta](https://avatars.githubusercontent.com/u/1894301?v=4)](https://github.com/Slauta "Slauta (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[rainlab/user-plugin

User plugin for October CMS

11955.0k15](/packages/rainlab-user-plugin)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.7k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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