PHPackages                             imanghafoori/laravel-tokenize-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. imanghafoori/laravel-tokenize-login

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

imanghafoori/laravel-tokenize-login
===================================

Helps you generate and send a random token to have passwordless login.

v1.0.7(3y ago)83236.1k↓72.3%5MITPHPPHP ^7.1.3|7.\*|8.\*

Since Jan 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/imanghafoori1/laravel-tokenized-login)[ Packagist](https://packagist.org/packages/imanghafoori/laravel-tokenize-login)[ Docs](https://github.com/imanghafoori1/tokenized-login)[ RSS](/packages/imanghafoori-laravel-tokenize-login/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (5)Versions (8)Used By (0)

Two factor authentication in Laravel
====================================

[](#two-factor-authentication-in-laravel)

[![Monthly Downloads](https://camo.githubusercontent.com/c9638935d39ef41324def5ec407aa3c669f5db49c889dd7f8fd4b4a2394025a1/68747470733a2f2f706f7365722e707567782e6f72672f696d616e676861666f6f72692f6c61726176656c2d746f6b656e697a652d6c6f67696e2f642f6d6f6e74686c79)](https://packagist.org/packages/imanghafoori/laravel-tokenize-login)[![Total Downloads](https://camo.githubusercontent.com/a1a14b3b8f054826c2a69bfb444afc5d7a9b82fc5129349d9e2e616caf61ee79/68747470733a2f2f706f7365722e707567782e6f72672f696d616e676861666f6f72692f6c61726176656c2d746f6b656e697a652d6c6f67696e2f646f776e6c6f616473)](https://packagist.org/packages/imanghafoori/laravel-tokenize-login)[![Latest Stable Version](https://camo.githubusercontent.com/130ab66e3bb4093a2d141a16b6c7629836caa219a76711fd03290716e28e5607/68747470733a2f2f706f7365722e707567782e6f72672f696d616e676861666f6f72692f6c61726176656c2d746f6b656e697a652d6c6f67696e2f762f737461626c65)](https://packagist.org/packages/imanghafoori/laravel-tokenize-login)[![Build Status](https://camo.githubusercontent.com/1901864a844210a635c4cc8c8d1bc8fe2008cd0b0e151d5ebafc164d0cf4c45b/68747470733a2f2f7472617669732d63692e6f72672f696d616e676861666f6f7269312f6c61726176656c2d746f6b656e697a65642d6c6f67696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/imanghafoori1/laravel-tokenized-login)[![Quality Score](https://camo.githubusercontent.com/e284e14a526721c615ed4a67f5e2bc62746220034c87158f7c1a87eb850f09e2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f696d616e676861666f6f7269312f746f6b656e697a65642d6c6f67696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/imanghafoori1/tokenized-login)[![StyleCI](https://camo.githubusercontent.com/24117371ac51a8dca6b8203b48b507d1911e979b636189295805d2e6d58260d2/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233373034313830312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/237041801)[![Software License](https://camo.githubusercontent.com/7b9d0faf11330a88ea80a58ccf5491f699d5edf7ddac76ad40e2a9dc6a77fd76/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d726f756e642d737175617265)](LICENSE.md)

This package creates an auto-expiring single-use 6-digit token, which you can send (can be SMS, email, slack, etc ) to your users and they can login into their account with that token by just sending it back to an endpoint, which is also provided out of the box.

Exactly like the alternate login method in Instagram.

You have complete control on how things will happen and you are free to swap the default implementations with your own.

Installation
============

[](#installation)

```
composer require imanghafoori/laravel-tokenize-login

```

Then publish the config file:

```
php artisan vendor:publish

```

### Basic usage:

[](#basic-usage)

Basically, this package introduces 2 endpoints, which you can send requests to them.

1. The first one is to generate and send the token to the user

```
POST '/tokenized-login/request-token?email=iman@example.com'
```

2. The second one accepts the token and authenticates the user if the token was valid.

```
POST '/tokenized-login/login?email=iman@example.com'
```

Note: If you are not happy with the shape if the urls, you are free to cancel these out, and redefine them where ever you want. you can take a look at the source code to find the controllers they refer to.

To disable the default routes you may set: `'use_default_routes' => false,` in the tokenized\_login config file.

### Customization:

[](#customization)

You can do a lot of customization and swap the default classes, with your own alternative since we use the larave-smart-facade package. Visit the config file to see what you can change.

If you want to swap the default implementations behind the facades with your own, you can do it within the `boot` method of any service provider class like this:

```
    /**
     * The lifetime of tokens in seconds.
     */
    'token_ttl' => 120,

    /**
     * The rules to validate the receiver address.
     * Usually it is an email address, but maybe a phone number.
     */
    'address_validation_rules' => ['required', 'email'],

    /**
     * Here you determine if you are ok with using the routes
     * defined in the package or you want to define them yourself.
     */
    'use_default_routes' => true,

    /**
     * Here you can specify the middlewares to be applied on
     * the routes, which the package has provided for you.
     */
    'route_middlewares' => ['api'],

    /**
     * You can define a prefix for the urls to avoid conflicts.
     * Note: the prefix should NOT end in a slash / character.
     */
    'route_prefix_url' => '/tokenized-login',

    /**
     * Notification class used to send the token.
     * You may define your own token sender class.
     */
    'token_sender' => \Imanghafoori\TokenizedLogin\TokenSender::class,

    /**
     * You can change the way you generate the token by defining you own class.
     */
    'token_generator' => \Imanghafoori\TokenizedLogin\TokenGenerators\TokenGenerator::class,

    /**
     * You can extend the Responses class and override
     * its methods, to define your own responses.
     */
    'responses' => \Imanghafoori\TokenizedLogin\Http\Responses\Responses::class,

    /**
     * You can change the way you fetch the user from your database
     * by defining a custom user provider class and set it here.
     */
    'user_provider' => \Imanghafoori\TokenizedLogin\UserProvider::class,

    /**
     * You may provide a middleware to throttle the
     * requesting and submission of the tokens.
     */
    'throttler_middleware' => 'throttle:3,1',
```

All the facades have a `shouldProxyTo` method which you can call, but remember not to do it within the `register` method, but only in `boot`.

---

### 🙋 Contributing

[](#raising_hand-contributing)

If you find an issue or have a better way to do something, feel free to open an issue or a pull request.

### ❗ Security

[](#exclamation-security)

If you discover any security related issues, please use the `security tab` instead of using the issue tracker.

### ⭐ Your Stars Make Us Do More ⭐

[](#star-your-stars-make-us-do-more-star)

As always if you found this package useful and want to encourage us to maintain and work on it. Just press the star button to declare your willingness.

More from the author:
---------------------

[](#more-from-the-author)

### Laravel microscope

[](#laravel-microscope)

💎 Test your laravel application without writing tests.

-

---

### Laravel HeyMan

[](#laravel-heyman)

💎 It allows to write expressive code to authorize, validate and authenticate.

-

---

### Laravel Terminator

[](#laravel-terminator)

💎 A minimal yet powerful package to give you opportunity to refactor your controllers.

-

---

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.5% 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 ~185 days

Recently: every ~270 days

Total

7

Last Release

1235d ago

PHP version history (4 changes)v1.0.0PHP ^7.1.3

v1.0.1PHP ^7.2

v1.0.2PHP ^7.1.3|7.2.\*|7.3.\*|7.4.\*

v1.0.7PHP ^7.1.3|7.\*|8.\*

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6961695?v=4)[Iman](/maintainers/imanghafoori1)[@imanghafoori1](https://github.com/imanghafoori1)

---

Top Contributors

[![imanghafoori1](https://avatars.githubusercontent.com/u/6961695?v=4)](https://github.com/imanghafoori1 "imanghafoori1 (55 commits)")[![i-iman-i](https://avatars.githubusercontent.com/u/57342246?v=4)](https://github.com/i-iman-i "i-iman-i (12 commits)")[![amirsadeghi1](https://avatars.githubusercontent.com/u/26359326?v=4)](https://github.com/amirsadeghi1 "amirsadeghi1 (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![erfantkerfan](https://avatars.githubusercontent.com/u/37825504?v=4)](https://github.com/erfantkerfan "erfantkerfan (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

phplaravellaravel-loginlaravel-passwordlesslaravel-authentication

### Embed Badge

![Health badge](/badges/imanghafoori-laravel-tokenize-login/health.svg)

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

###  Alternatives

[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.8M47](/packages/santigarcor-laratrust)[imanghafoori/laravel-password-history

A package to keep a history of all password changes of users

70221.8k2](/packages/imanghafoori-laravel-password-history)[imanghafoori/laravel-masterpass

A minimal yet powerful package to help you easily impersonate your users.

370259.4k](/packages/imanghafoori-laravel-masterpass)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

59437.0k9](/packages/jeremy379-laravel-openid-connect)

PHPackages © 2026

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