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 1mo 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 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

859d 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

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

324339.9k4](/packages/casbin-laravel-authz)[sammyjo20/lasso

Lasso - Asset wrangling for Laravel made simple.

355347.9k](/packages/sammyjo20-lasso)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)

PHPackages © 2026

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