PHPackages                             scriptoshi/livewire-otp-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. scriptoshi/livewire-otp-auth

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

scriptoshi/livewire-otp-auth
============================

OTP authentication for Laravel with Livewire

1.0.4(3mo ago)0104MITPHPPHP ^8.2

Since Mar 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/scriptoshi/livewire-otp-auth)[ Packagist](https://packagist.org/packages/scriptoshi/livewire-otp-auth)[ RSS](/packages/scriptoshi-livewire-otp-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (6)Used By (0)

Livewire OTP Authentication
===========================

[](#livewire-otp-authentication)

A simple and easy-to-use OTP (One-Time Password) Email authentication package for Laravel 12 using Livewire 3.

Features
--------

[](#features)

- OTP-based authentication for your Laravel application
- Simple email-based verification
- Support for login, registration, and email validation flows
- Rate limiting for OTP requests
- Customizable expiration times
- Responsive UI with live input validation using Flux components
- Easy integration with existing Laravel applications

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

[](#requirements)

- PHP 8.2+
- Laravel 12.x
- Livewire 3.x
- Flux 2.x

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

[](#installation)

You can install the package via composer:

```
composer require scriptoshi/livewire-otp-auth
```

This will automatically install Livewire and Flux if they're not already in your project.

After installing the package, you need to run the migrations:

```
php artisan migrate
```

This will add the necessary columns to your users table.

Configuration
-------------

[](#configuration)

You can publish the configuration file:

```
php artisan vendor:publish --tag=livewire-otp-auth
```

This will create a `livewire-otp-auth.php` file in your `config` directory. You can modify the following settings:

- **expiration\_time**: How long an OTP is valid for in minutes (default: 10)
- **otp\_length**: The length of the OTP code (default: 6)
- **resend\_cooldown**: Cooldown time in seconds before a user can request another OTP (default: 60)
- **rate\_limit\_attempts**: Number of OTP attempts before rate limiting is applied (default: 5)
- **rate\_limit\_duration**: Duration in minutes for which rate limiting is applied (default: 5)

Usage
-----

[](#usage)

### 1. Add the trait to your User model

[](#1-add-the-trait-to-your-user-model)

First, add the `HasOtpAuth` trait to your User model:

```
use Scriptoshi\LivewireOtpAuth\Traits\HasOtpAuth;

class User extends Authenticatable
{
    use HasOtpAuth;

    // ...
}
```

### 2. Make sure Flux is properly set up

[](#2-make-sure-flux-is-properly-set-up)

If you haven't already set up Flux in your project, follow the [official Flux documentation](https://github.com/livewire/flux) to make sure it's properly configured.

### 3. Add the component to your views

[](#3-add-the-component-to-your-views)

You can now add the OTP authentication component to your views:

```

```

By default, this will use the `login` type and the `request` step. You can customize this by passing parameters:

```

```

Available types:

- `login`: For existing users (default)
- `register`: For new users (requires a name field)
- `validate`: For validating emails of logged-in users

### 4. Customizing the UI

[](#4-customizing-the-ui)

If you want to customize the UI, you can publish the views:

```
php artisan vendor:publish --tag=livewire-otp-auth
```

Then you can edit the views in `resources/views/vendor/livewire-otp-auth`.

### 5. Configure Tailwind CSS

[](#5-configure-tailwind-css)

To ensure that Tailwind CSS properly processes the component styles, add this package to your content sources in your CSS file (typically `resources/css/app.css`):

```
/* Add this line with your other @source directives */
@source '../../vendor/scriptoshi/livewire-otp-auth/resources/views/**/*.blade.php';
```

For example, your CSS file might look similar to this:

```
@import "tailwindcss";
@source "../views";
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../vendor/scriptoshi/livewire-otp-auth/resources/views/**/*.blade.php';
/* Rest of your CSS file */
```

### 6. Flux Components

[](#6-flux-components)

This package uses Flux components to provide a consistent and beautiful UI. The components include:

- `flux:input` - Used for email and name inputs
- `flux:button` - Used for action buttons

These components automatically inherit your application's theme and styling, providing a seamless integration with your Laravel application.

Routes
------

[](#routes)

The package automatically registers a route for verifying OTPs via email links:

```
GET /otp/verify/{code}

```

This route is named `otp.verify` and can be used to verify OTPs sent via email.

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance82

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~83 days

Total

5

Last Release

98d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b11cbb2bd5d92b45e8e0c9ac7c644e33d72b02a792ffb399283d4566678c72eb?d=identicon)[scriptoshi](/maintainers/scriptoshi)

---

Top Contributors

[![ofumbi](https://avatars.githubusercontent.com/u/4081256?v=4)](https://github.com/ofumbi "ofumbi (5 commits)")[![scriptoshi](https://avatars.githubusercontent.com/u/189149148?v=4)](https://github.com/scriptoshi "scriptoshi (1 commits)")

### Embed Badge

![Health badge](/badges/scriptoshi-livewire-otp-auth/health.svg)

```
[![Health](https://phpackages.com/badges/scriptoshi-livewire-otp-auth/health.svg)](https://phpackages.com/packages/scriptoshi-livewire-otp-auth)
```

###  Alternatives

[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[casbin/laravel-authz

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

324339.9k4](/packages/casbin-laravel-authz)[yajra/laravel-acl

Laravel ACL is a simple role, permission ACL for Laravel Framework.

112103.9k1](/packages/yajra-laravel-acl)[scaler-tech/laravel-saml2

SAML2 Service Provider integration for Laravel applications, based on OneLogin toolkit

2737.5k](/packages/scaler-tech-laravel-saml2)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2011.0k](/packages/alajusticia-laravel-logins)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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