PHPackages                             daikazu/laravel-frontdoor - 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. daikazu/laravel-frontdoor

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

daikazu/laravel-frontdoor
=========================

OTP-based passwordless email authentication for Laravel. No database tables required — codes stored in cache, identity in session.

v1.1.0(1mo ago)018MITPHPPHP ^8.3CI passing

Since Feb 7Pushed 1mo agoCompare

[ Source](https://github.com/daikazu/laravel-frontdoor)[ Packagist](https://packagist.org/packages/daikazu/laravel-frontdoor)[ Docs](https://github.com/daikazu/laravel-frontdoor)[ GitHub Sponsors](https://github.com/Daikazu)[ RSS](/packages/daikazu-laravel-frontdoor/feed)WikiDiscussions main Synced 1mo ago

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

  ![Logo for Frontdoor](art/header-light.png)[![Latest Version on Packagist](https://camo.githubusercontent.com/f054de18fc391377d9f682dde01d0fdeac24ef217963103d4067726d3feea711/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461696b617a752f6c61726176656c2d66726f6e74646f6f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/daikazu/laravel-frontdoor)[![GitHub Tests Action Status](https://camo.githubusercontent.com/23105ec45d849930ec2979f43edfec5699a098d8cdb0f89c7d212f9f660c84d5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461696b617a752f6c61726176656c2d66726f6e74646f6f722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/daikazu/laravel-frontdoor/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/372b77fe2af3a7f912b892cfed3de69cedd176d8b7ab0109f84d59e3fb65e3fb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461696b617a752f6c61726176656c2d66726f6e74646f6f722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/daikazu/laravel-frontdoor/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a7c291c56fef39331f6c796829a18e0d3ecc345b2dcbd2d2d5a7f4934a91a2bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461696b617a752f6c61726176656c2d66726f6e74646f6f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/daikazu/laravel-frontdoor)

Laravel Frontdoor
=================

[](#laravel-frontdoor)

A driver base Passwordless authentication for Laravel applications. Users log in by receiving a one-time code via email. No database migrations required. Session-based authentication with extensible account providers.

Features
--------

[](#features)

- **Passwordless Authentication** - Users log in with one-time codes sent to their email
- **Driver-Based Account System** - Built-in testing driver to get started, then register your own driver class in config
- **Optional Registration** - Enable self-service account creation with compatible drivers
- **Zero Database Requirements** - Works out of the box with session authentication and the testing driver
- **Livewire Integration** - Reactive UI components with Alpine.js fallback
- **Deterministic Avatars** - Beautiful gradient avatars generated from email hashes
- **Rate Limiting** - Built-in protection against brute force attacks
- **Event System** - Listen to authentication and registration events throughout the flow

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 12+
- Livewire 3.0+ or 4.0+

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

[](#installation)

Install the package via Composer:

```
composer require daikazu/laravel-frontdoor
```

Publish the configuration file:

```
php artisan vendor:publish --tag="laravel-frontdoor-config"
```

Quick Start
-----------

[](#quick-start)

Get up and running in 2 minutes using the built-in testing driver.

### 1. Add Seed Users

[](#1-add-seed-users)

Open `config/frontdoor.php` and add email addresses to try the package with:

```
'accounts' => [
    'driver' => 'testing',

    'drivers' => [
        'testing' => [
            'users' => [
                'jane@example.com' => [
                    'name' => 'Jane Doe',
                ],
                'john@example.com' => [
                    'name' => 'John Smith',
                ],
            ],
        ],
    ],
],
```

### 2. Add the Login Component

[](#2-add-the-login-component)

Add the navigation component to your layout:

```

```

That's it! Users can now:

1. Click the login button
2. Enter their email address
3. Receive a one-time code via email
4. Enter the code to log in

New users (when registration is enabled) follow a slightly different flow:

1. Enter their email — prompted to create an account
2. Verify email ownership via OTP
3. Fill in the registration form
4. Account is created and user is automatically logged in

Account Drivers
---------------

[](#account-drivers)

Laravel Frontdoor uses a **driver-based system** for looking up user accounts. The active driver is set via the `accounts.driver` config key and determines where accounts are stored and looked up.

When a user attempts to log in:

1. The email is passed to the driver's `findByEmail()` method
2. The driver returns an `AccountData` object if the account exists, or `null` if not
3. If found, an OTP is generated and emailed
4. After OTP verification, the user is authenticated with a session

### Testing Driver (Default)

[](#testing-driver-default)

The package ships with a `testing` driver for development and trying out the package. It stores seed users from your config and any new registrations in cache. It is not intended for production use.

```
'accounts' => [
    'driver' => 'testing',

    'drivers' => [
        'testing' => [
            'users' => [
                'admin@example.com' => [
                    'name' => 'Admin User',
                    'phone' => '+1-555-0100',
                    'metadata' => ['role' => 'admin'],
                ],
            ],
        ],
    ],
],
```

The testing driver supports registration out of the box. To try it, enable registration in config:

```
'registration' => [
    'enabled' => true,
],
```

New accounts registered through the UI are stored in cache and persist until the cache is cleared.

### Using Your Own Driver

[](#using-your-own-driver)

For production use, create a driver class that implements `AccountDriver` and register it in config. There are two ways to do this:

**Option A: Named driver** — add an entry to the `drivers` array and reference it by name:

```
'accounts' => [
    'driver' => 'salesforce',

    'drivers' => [
        'salesforce' => \App\Frontdoor\SalesforceAccountDriver::class,
    ],
],
```

**Option B: FQCN** — set the driver directly to the class name:

```
'accounts' => [
    'driver' => \App\Frontdoor\SalesforceAccountDriver::class,
],
```

Both approaches resolve the class from Laravel's service container automatically. Named drivers are useful when you want to switch between drivers via environment variables (e.g. `FRONTDOOR_ACCOUNT_DRIVER=salesforce`).

#### Creating a Driver (Sign-in Only)

[](#creating-a-driver-sign-in-only)

Implement the `AccountDriver` interface with two methods:

```
