PHPackages                             mrshanebarron/otp-input - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mrshanebarron/otp-input

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mrshanebarron/otp-input
=======================

OTP/2FA code input component for Laravel - supports Livewire and Vue

v1.0.4(6mo ago)0174↓87.5%MITVuePHP ^8.1

Since Dec 14Pushed 6mo agoCompare

[ Source](https://github.com/mrshanebarron/otp-input)[ Packagist](https://packagist.org/packages/mrshanebarron/otp-input)[ RSS](/packages/mrshanebarron-otp-input/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (1)Versions (6)Used By (0)

OTP Input
=========

[](#otp-input)

A one-time password input component for Laravel applications. Individual digit inputs for verification codes. Works with Livewire and Vue 3.

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

[](#installation)

```
composer require mrshanebarron/otp-input
```

Livewire Usage
--------------

[](#livewire-usage)

### Basic Usage

[](#basic-usage)

```

```

### Custom Length

[](#custom-length)

```

```

### Livewire Props

[](#livewire-props)

PropTypeDefaultDescription`wire:model`string`''`Complete OTP value`length`number`6`Number of digits`input-class`string`'border-gray-300'`Input stylingVue 3 Usage
-----------

[](#vue-3-usage)

### Setup

[](#setup)

```
import { SbOtpInput } from './vendor/sb-otp-input';
app.component('SbOtpInput', SbOtpInput);
```

### Basic Usage

[](#basic-usage-1)

```

import { ref } from 'vue';

const code = ref('');

const handleComplete = (otp) => {
  console.log('OTP entered:', otp);
  verifyCode(otp);
};

```

### 4-Digit PIN

[](#4-digit-pin)

```

    Enter PIN

```

### Verification Form Example

[](#verification-form-example)

```

    Verification

      Enter the 6-digit code sent to your phone

    {{ error }}

      Didn't receive code? Resend

import { ref } from 'vue';

const code = ref('');
const error = ref('');

const verify = async (otp) => {
  try {
    await api.verifyOTP(otp);
    // Redirect on success
  } catch (e) {
    error.value = 'Invalid code. Please try again.';
    code.value = '';
  }
};

const resend = async () => {
  await api.resendOTP();
  error.value = '';
};

```

### Vue Props

[](#vue-props)

PropTypeDefaultDescription`modelValue`String`''`Complete OTP value`length`Number`6`Number of input boxes`inputClass`String`'border-gray-300'`Additional input classes### Events

[](#events)

EventPayloadDescription`update:modelValue``string`Value changed`complete``string`All digits enteredKeyboard Behavior
-----------------

[](#keyboard-behavior)

KeyAction`0-9`Enter digit, auto-advance`Backspace`Clear and go back`←`Move to previous input`→`Move to next input`Paste`Auto-fill from clipboardFeatures
--------

[](#features)

- **Auto-Advance**: Focus moves to next input automatically
- **Paste Support**: Paste full code to auto-fill
- **Backspace Navigation**: Goes to previous on empty backspace
- **Arrow Keys**: Navigate between inputs
- **Numeric Only**: Filters non-numeric characters
- **Auto-Select**: Selects digit on focus
- **Complete Event**: Fires when all digits entered

Styling
-------

[](#styling)

Uses Tailwind CSS:

- Large centered digits
- Focus ring highlight
- Equal-width inputs
- Customizable border color

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12
- Tailwind CSS 3.x

License
-------

[](#license)

MIT License

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance68

Regular maintenance activity

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Total

5

Last Release

185d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/193358540?v=4)[Mr Shane Barron](/maintainers/mrshanebarron)[@mrshanebarron](https://github.com/mrshanebarron)

### Embed Badge

![Health badge](/badges/mrshanebarron-otp-input/health.svg)

```
[![Health](https://phpackages.com/badges/mrshanebarron-otp-input/health.svg)](https://phpackages.com/packages/mrshanebarron-otp-input)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pipeline

The Illuminate Pipeline package.

9348.3M267](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10533.5M989](/packages/illuminate-pagination)[illuminate/redis

The Illuminate Redis package.

8314.4M362](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

224.5M132](/packages/illuminate-cookie)

PHPackages © 2026

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