PHPackages                             jhumanj/laravel-signed-auth-middleware - 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. jhumanj/laravel-signed-auth-middleware

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

jhumanj/laravel-signed-auth-middleware
======================================

A Laravel package that can authenticate users using signed links

1.0.1(5y ago)3141MITPHPPHP ^7.4|^8.0

Since Feb 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/JhumanJ/laravel-signed-auth-middleware)[ Packagist](https://packagist.org/packages/jhumanj/laravel-signed-auth-middleware)[ Docs](https://github.com/jhumanj/laravel-signed-auth-middleware)[ RSS](/packages/jhumanj-laravel-signed-auth-middleware/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (7)Versions (3)Used By (0)

Laravel Signed Auth Middleware
==============================

[](#laravel-signed-auth-middleware)

---

A simple, safe magic login link generator for Laravel
-----------------------------------------------------

[](#a-simple-safe-magic-login-link-generator-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c758ffa67d5c4e955a33c83cc5fe2290ee78e1f15d8ca55e2ab7ea8edd69b1d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a68756d616e6a2f6c61726176656c2d7369676e65642d617574682d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jhumanj/laravel-signed-auth-middleware)[![GitHub Tests Action Status](https://github.com/jhumanj/laravel-signed-auth-middleware/workflows/Tests/badge.svg)](https://github.com/jhumanj/laravel-signed-auth-middleware/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/fa8795d995d8b0513392fb6503639e8aaef57f5d67755aba576e1f90a71b0519/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6a68756d616e6a2f6c61726176656c2d7369676e65642d617574682d6d6964646c65776172652f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/jhumanj/laravel-signed-auth-middleware/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/9349bca2f087e7163dd7fa46d450de1688e47e6a31969fa7c2aee384bbc3f27f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a68756d616e6a2f6c61726176656c2d7369676e65642d617574682d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jhumanj/laravel-signed-auth-middleware)

This packages allows you to generate links that will authenticate your users. You can use this for password-less applications, or simply to authenticate users from links your application sends (via email, text message etc.).

Why this package
----------------

[](#why-this-package)

I started to use [laravel-passwordless-login](https://github.com/grosv/laravel-passwordless-login) package by [grosv](https://github.com/grosv) and it worked very well. Unfortunately, because of the redirection, I had some troubles with Google analytics and UTM tracking. I wanted to extend the package, but then realized that there wasn't a trivial solution, as utm tracking parameters should not be used in the context of intenal website navigation. Hence I created this package, which is very strongly inspired by [laravel-passwordless-login](https://github.com/grosv/laravel-passwordless-login).

Signed Auth Middleware package allows you to generate signed links that will automatically authenticate your users using a middleware (without any redirect). Unlike [laravel-passwordless-login](https://github.com/grosv/laravel-passwordless-login), this package does not support the `use-once` link feature.

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

[](#installation)

You can install the package via composer:

```
composer require jhumanj/laravel-signed-auth-middleware
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-signed-auth-middleware-config"
```

This is the contents of the published config file:

```
return [
    'signature_param_name' => 'auth-signature',
    'default_expire' => 60,
    'remember_login' => true,
    'user_guard' => 'web'
];
```

Usage
-----

[](#usage)

### Setting up middleware

[](#setting-up-middleware)

The first thing to do is to setup the middleware. The middleware needs to be registered before the auth middleware. You can achieve that by adding the `HasSignedAuth` trait to your `App\Http\Kernel.php` file:

```
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use JhumanJ\LaravelSignedAuthMiddleware\Traits\HasSignedAuth;

class Kernel extends HttpKernel
{
    use HasSignedAuth;

    // ...

    public function __construct(Application $app, Router $router)
    {
        parent::__construct($app, $router);

        $this->setupSignedAuthMiddleware();
    }
}
```

Then you have two options: use the middleware on all or your routes or not. To add the middleware to all your routes, add the middleware to the web middleware group.

```
   // App/Http/Kernel.php

   protected $middlewareGroups = [
        'web' => [
            // ...
            \JhumanJ\LaravelSignedAuthMiddleware\SignedAuthMiddleware::class,
        ],
    ];
```

Now if you don't want to use the middleware on all of your web routes you can also define a route middleware like this:

```
// Kernel.php
protected $routeMiddleware = [
    'auth.signed' => \JhumanJ\LaravelSignedAuthMiddleware\SignedAuthMiddleware::class,
];
```

And then use it as follows in your route file:

```
// routes/web.php
Route::get('/', function () {
    return view('welcome');
})->middleware('auth.signed','auth');
```

### Creating auth signed links

[](#creating-auth-signed-links)

Here is how to generate a signed link that will authenticate your users:

```
use JhumanJ\LaravelSignedAuthMiddleware\Facades\SignedAuth;

$signedUrl = SignedAuth::forUser($user)
                ->route('welcome')
                ->generate();
```

You can also override the default expiry time:

```
use JhumanJ\LaravelSignedAuthMiddleware\Facades\SignedAuth;

$signedUrl = SignedAuth::forUser($user)
                ->expired(60*24) // expires in 24 hours
                ->route('welcome')
                ->generate();
```

Or you set it to never expire:

```
use JhumanJ\LaravelSignedAuthMiddleware\Facades\SignedAuth;

$signedUrl = SignedAuth::forUser($user)
                ->neverExpires()
                ->route('welcome')
                ->generate();
```

If you need to add some more parameters, just proceed as you would do it with the normal `route()` method:

```
use JhumanJ\LaravelSignedAuthMiddleware\Facades\SignedAuth;

$signedUrl = SignedAuth::forUser($user)
                ->route('welcome',[
                    'utm_source' => 'source',
                    'utm_medium' => 'medium',
                    'utm_campaign' => 'utm_campaign'
                ])
                ->generate();
```

Testing
-------

[](#testing)

Please make sure that all package tests are running successfully before sending a pull request.

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please contribute if you want to help me maintain this package or just make it better. Be nice to each other.

Reporting Issues
----------------

[](#reporting-issues)

For security issues, please contact me directly on [twitter](https://twitter.com/JhumanJ) or via email at . For any other problems, use the issue tracker here.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

Every ~0 days

Total

2

Last Release

1912d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4588922bc88319d4eafea8529f68fc9be2c1aab32a8f081530ce43efc197dd1b?d=identicon)[JhumanJ](/maintainers/JhumanJ)

---

Top Contributors

[![JhumanJ](https://avatars.githubusercontent.com/u/11312432?v=4)](https://github.com/JhumanJ "JhumanJ (13 commits)")

---

Tags

jhumanjlaravel-signed-auth-middleware

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jhumanj-laravel-signed-auth-middleware/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[jeffgreco13/filament-breezy

A custom package for Filament with login flow, profile and teams support.

1.0k1.7M41](/packages/jeffgreco13-filament-breezy)[spatie/laravel-login-link

Quickly login to your local environment

4381.2M1](/packages/spatie-laravel-login-link)[ryangjchandler/laravel-cloudflare-turnstile

A simple package to help integrate Cloudflare Turnstile.

438896.6k2](/packages/ryangjchandler-laravel-cloudflare-turnstile)[spatie/laravel-passkeys

Use passkeys in your Laravel app

444494.4k16](/packages/spatie-laravel-passkeys)

PHPackages © 2026

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