PHPackages                             mralston/laravel-passwordless-login - 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. mralston/laravel-passwordless-login

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

mralston/laravel-passwordless-login
===================================

Passwordless login using temporary signed URL

v12.0.0(10mo ago)081MITPHPPHP ^7.3|^8.0CI failing

Since Feb 28Pushed 10mo agoCompare

[ Source](https://github.com/mralston/laravel-passwordless-login)[ Packagist](https://packagist.org/packages/mralston/laravel-passwordless-login)[ RSS](/packages/mralston-laravel-passwordless-login/feed)WikiDiscussions main Synced today

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

Laravel Passwordless Login
==========================

[](#laravel-passwordless-login)

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

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

[![build status](https://github.com/grosv/laravel-passwordless-login/actions/workflows/test.yml/badge.svg)](https://github.com/grosv/laravel-passwordless-login/actions/workflows/test.yml/badge.svg)

This package provides a temporary signed route that logs in a user. What it does not provide is a way of actually sending the link to the route to the user. This is because I don't want to make any assumptions about how you communicate with your users.

### Installation

[](#installation)

```
composer require mralston/laravel-passwordless-login
```

### Simple Usage

[](#simple-usage)

```
use App\User;
use Mralston\LaravelPasswordlessLogin\LoginUrl;

function sendLoginLink()
{
  $user = User::find(1);

  $generator = new LoginUrl($user);
  $generator->setRedirectUrl("/somewhere/else"); // Override the default url to redirect to after login
  $url = $generator->generate();

  //OR Use a Facade
  $url = PasswordlessLogin::forUser($user)->generate();

  // Send $url in an email or text message to your user
}
```

### Using A Trait

[](#using-a-trait)

Because some sites have more than one user-type model (users, admins, etc.), you can use a trait to set up the default configurations for each user type. The methods below are provided by the trait, so you only need to include the ones for which you want to use a different value.

```
use Mralston\LaravelPasswordlessLogin\Traits\PasswordlessLogin;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
  use PasswordlessLogin;

  public function getGuardNameAttribute(): string
  {
    return config("laravel-passwordless-login.user_guard");
  }

  public function getShouldRememberLoginAttribute(): bool
  {
    return config("laravel-passwordless-login.remember_login");
  }

  public function getLoginRouteExpiresInAttribute(): int
  {
    return config("laravel-passwordless-login.login_route_expires");
  }

  public function getRedirectUrlAttribute(): string
  {
    return config("laravel-passwordless-login.redirect_on_success");
  }
}
```

If you are using the PasswordlessLogin Trait, you can generate a link using the defaults defined in the trait by simply calling `createPasswordlessLoginLink()` on the user you want to log in.

The biggest mistake I could see someone making with this package is creating a login link for one user and sending it to another. Please be careful and test your code. I don't want anyone getting mad at me for someone else's silliness.

### Configuration

[](#configuration)

You can publish the config file or just set the values you want to use in your .env file:

```
LPL_USER_MODEL=App\User
LPL_REMEMBER_LOGIN=false
LPL_LOGIN_ROUTE=/magic-login
LPL_LOGIN_ROUTE_NAME=magic-login
LPL_LOGIN_ROUTE_EXPIRES=30
LPL_REDIRECT_ON_LOGIN=/
LPL_USER_GUARD=web
LPL_USE_ONCE=false
LPL_INVALID_SIGNATURE_MESSAGE="Expired or Invalid Link"
```

`LPL_USER_MODEL` is the the authenticatable model you are logging in (usually App\\User)

`LPL_REMEMBER_LOGIN` is whether you want to remember the login (like the user checking Remember Me)

`LPL_LOGIN_ROUTE` is the route that points to the login function this package provides. Make sure you don't collide with one of your other routes.

`LPL_LOGIN_ROUTE_NAME` is the name of the LPL\_LOGIN\_ROUTE. Again, make sure it doesn't collide with any of your existing route names.

`LPL_LOGIN_ROUTE_EXPIRES` is the number of minutes you want the link to be good for. I recommend you set the shortest value that makes sense for your use case.

`LPL_REDIRECT_ON_LOGIN` is where you want to send the user after they've logged in by clicking their magic link.

`LPL_USE_ONCE` is whether you want a link to expire after first use (uses cache to store used links)

`LPL_INVALID_SIGNATURE_MESSAGE` is a custom message sent when we abort with a 401 status on an invalid or expired link. You can also add some custom logic on how to deal with invalid or expired links by handling `InvalidSignatureException` and `ExpiredSignatureException` in your `Handler.php` file.

### Reporting Issues

[](#reporting-issues)

For security issues, please email me directly at . For any other problems, use the issue tracker here.

### Contributing

[](#contributing)

I welcome the community's help with improving and maintaining all my packages. Just be nice to each other. Remember we're all just trying to do our best.

###  Health Score

39

—

LowBetter than 87% of packages

Maintenance54

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~462 days

Total

14

Last Release

309d ago

Major Versions

0.2.0 → 1.0.02020-03-11

1.3.0 → 11.0.02024-04-29

11.0.1 → v12.0.02025-05-16

PHP version history (2 changes)0.1.0PHP ^7.3

11.0.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/248387?v=4)[Matt](/maintainers/mralston)[@mralston](https://github.com/mralston)

---

Top Contributors

[![kamiben](https://avatars.githubusercontent.com/u/389495?v=4)](https://github.com/kamiben "kamiben (41 commits)")[![edgrosvenor](https://avatars.githubusercontent.com/u/1053395?v=4)](https://github.com/edgrosvenor "edgrosvenor (37 commits)")[![innoflash](https://avatars.githubusercontent.com/u/12772919?v=4)](https://github.com/innoflash "innoflash (35 commits)")[![JhumanJ](https://avatars.githubusercontent.com/u/11312432?v=4)](https://github.com/JhumanJ "JhumanJ (6 commits)")[![ashleighsims](https://avatars.githubusercontent.com/u/1674351?v=4)](https://github.com/ashleighsims "ashleighsims (4 commits)")[![mralston](https://avatars.githubusercontent.com/u/248387?v=4)](https://github.com/mralston "mralston (4 commits)")[![edalzell](https://avatars.githubusercontent.com/u/6069653?v=4)](https://github.com/edalzell "edalzell (3 commits)")[![afzafri](https://avatars.githubusercontent.com/u/14824387?v=4)](https://github.com/afzafri "afzafri (2 commits)")[![iman-ragab](https://avatars.githubusercontent.com/u/79089798?v=4)](https://github.com/iman-ragab "iman-ragab (1 commits)")[![joe-pritchard](https://avatars.githubusercontent.com/u/25373032?v=4)](https://github.com/joe-pritchard "joe-pritchard (1 commits)")[![felixdorn](https://avatars.githubusercontent.com/u/55788595?v=4)](https://github.com/felixdorn "felixdorn (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![likeadeckofcards](https://avatars.githubusercontent.com/u/6399755?v=4)](https://github.com/likeadeckofcards "likeadeckofcards (1 commits)")[![benrolfe](https://avatars.githubusercontent.com/u/474175?v=4)](https://github.com/benrolfe "benrolfe (1 commits)")[![pktharindu](https://avatars.githubusercontent.com/u/23132672?v=4)](https://github.com/pktharindu "pktharindu (1 commits)")[![ReinisL](https://avatars.githubusercontent.com/u/18574406?v=4)](https://github.com/ReinisL "ReinisL (1 commits)")[![rico](https://avatars.githubusercontent.com/u/92818?v=4)](https://github.com/rico "rico (1 commits)")

### Embed Badge

![Health badge](/badges/mralston-laravel-passwordless-login/health.svg)

```
[![Health](https://phpackages.com/badges/mralston-laravel-passwordless-login/health.svg)](https://phpackages.com/packages/mralston-laravel-passwordless-login)
```

###  Alternatives

[dusterio/lumen-passport

Making Laravel Passport work with Lumen

6511.2M9](/packages/dusterio-lumen-passport)[culturekings/shopify-app-auth-laravel

Shopify OAuth App for Laravel 5.x

1013.3k](/packages/culturekings-shopify-app-auth-laravel)

PHPackages © 2026

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