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

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

skofi/laravel-jwt-auth
======================

JWT Authentication with Mail confirmation for Laravel

1.0(2y ago)04MITPHPPHP ^8.1

Since Jan 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/SkofiTI/laravel-jwt-auth)[ Packagist](https://packagist.org/packages/skofi/laravel-jwt-auth)[ RSS](/packages/skofi-laravel-jwt-auth/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Laravel JWT Authorization
=========================

[](#laravel-jwt-authorization)

This repository provides full functionality for authorization and mail confirmation using JWT (JSON Web Tokens) in a Laravel application.

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

[](#installation)

To set up JWT authentication and mail confirmation, follow these steps:

1. Run the following command to install the `skofi/laravel-jwt-auth` package:

    ```
    composer require skofi/laravel-jwt-auth
    ```
2. Run the following command to install JWT authentication:

    ```
    php artisan jwt-auth:install
    ```
3. Publish the vendor for JWT authentication:

    ```
    php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
    ```

Middleware for JWT
------------------

[](#middleware-for-jwt)

Add the following middleware for JWT authentication in your `Kernel.php`:

```
protected $middlewareAliases = [
    // ...
    'auth.jwt' => \Tymon\JWTAuth\Http\Middleware\Authenticate::class,
];
```

User Model Implementation
-------------------------

[](#user-model-implementation)

Implement the JWTSubject interface in the User model as follows:

```
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class User extends Authenticatable implements JWTSubject
{
    // ... (other user model code)

    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }
}
```

Password Reset Route Configuration
----------------------------------

[](#password-reset-route-configuration)

In the AuthServiceProvider of the boot() method, add the following code to configure the password reset route to redirect to the frontend URL:

```
use Illuminate\Auth\Notifications\ResetPassword;

// ... (other imports and code)

class AuthServiceProvider extends ServiceProvider
{
    /**
     * Register any authentication / authorization services.
    */
    public function boot(): void
    {
        ResetPassword::createUrlUsing(function ($user, string $token) {
            return config('app.frontend_url') . '/reset-password?token=' . $token . '&email=' . $user->email;
        });
    }
    // ...
}
```

Time-to-live JWT
----------------

[](#time-to-live-jwt)

You can define variables in your `.env` file to customize the token's time-to-live (TTL) settings:

```
JWT_TTL=1440
JWT_REMEMBER_TTL=525600

```

- `JWT_TTL` denotes the standard token lifetime in minutes.
- `JWT_REMEMBER_TTL` represents the token's lifetime when the 'Remember me' option is selected, also in minutes.

Generate secret key
-------------------

[](#generate-secret-key)

This key serves as the signature for your tokens, and the process will depend on the algorithm you choose to use.

```
php artisan jwt:secret
```

Usage
-----

[](#usage)

- Once the setup is complete, you can use JWT authentication for user authorization.
- Password reset links will be generated based on the configured `FRONTEND_URL=` in your `.env`.

Contribution
------------

[](#contribution)

Feel free to contribute by opening issues or submitting pull requests.

License
-------

[](#license)

This project is licensed under the [MIT](https://github.com/SkofiTI/laravel-jwt-auth/blob/main/LICENSE) License.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

912d ago

### Community

Maintainers

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

---

Top Contributors

[![SkofiTI](https://avatars.githubusercontent.com/u/69329571?v=4)](https://github.com/SkofiTI "SkofiTI (3 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[laravel/folio

Page based routing for Laravel.

603583.7k33](/packages/laravel-folio)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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