PHPackages                             mokhosh/filament-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. mokhosh/filament-otp-input

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

mokhosh/filament-otp-input
==========================

Otp input for filament

v1.0.0(1y ago)2110MITBladePHP ^8.1CI failing

Since Oct 18Pushed 1y agoCompare

[ Source](https://github.com/mokhosh/filament-otp-input)[ Packagist](https://packagist.org/packages/mokhosh/filament-otp-input)[ Docs](https://github.com/mokhosh/filament-otp-input)[ RSS](/packages/mokhosh-filament-otp-input/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (12)Versions (5)Used By (0)

Filament One-Time Passcode (OTP) Input Form Component
=====================================================

[](#filament-one-time-passcode-otp-input-form-component)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6132da39c8a2b812552b28fbb52ed80b63fa4436f70a3c810c03b5799583c410/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686173616e2d6168616e692f66696c616d656e742d6f74702d696e7075742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hasan-ahani/filament-otp-input)[![Total Downloads](https://camo.githubusercontent.com/05e73449ed179c216d7a86c14ed7bac81157561b84729f972ca72f3b1717a4b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686173616e2d6168616e692f66696c616d656e742d6f74702d696e7075742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hasan-ahani/filament-otp-input)[![PHP from Packagist](https://camo.githubusercontent.com/254845ff07662c0e89d9a4aa30aa1b641e3962213984b3c6f2aa74e34c933927/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686173616e2d6168616e692f66696c616d656e742d6f74702d696e7075743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hasan-ahani/filament-otp-input)[![Tests](https://github.com/hasan-ahani/filament-otp-input/workflows/Tests/badge.svg?style=flat-square)](https://github.com/hasan-ahani/filament-otp-input/workflows/Tests/badge.svg?style=flat-square)[![License](https://camo.githubusercontent.com/f557558fcf3ef23a0248bf45ed1466e2eb36852a6fc732bb335ab7b89baba255/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f686173616e2d6168616e692f66696c616d656e742d6f74702d696e7075743f7374796c653d666c61742d737175617265)](https://github.com/hasan-ahani/filament-otp-input/blob/main/LICENSE.md)

[![One-Time Passcode (OTP) input for Filament](https://raw.githubusercontent.com/hasan-ahani/filament-otp-input/master/docs/thumbnail.jpg)](https://raw.githubusercontent.com/hasan-ahani/filament-otp-input/master/docs/thumbnail.jpg)

`filament-otp-input` is a package built for [Filament](https://filamentphp.com) that provides a One-Time Passcode (OTP) input form component that offers you the ability to add the following features:

- Customize the number of inputs
- Perform an action after filling the code
- Move to the next input after filling
- Move to the previous input with backspaces

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

[](#installation)

You can install the package via composer:

```
composer require hasan-ahani/filament-otp-input
```

Usage
-----

[](#usage)

Inside a form schema, you can use the Otp input like this:

```
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;

public function form(Form $form): Form
{
    return $form
        ->schema([
            // ...
            OtpInput::make('otp')
                ->label('Otp'),
        ]);
}
```

The code above will render a otp input inside the form.

[![Otp input](https://raw.githubusercontent.com/hasan-ahani/filament-otp-input/master/docs/otp.png)](https://raw.githubusercontent.com/hasan-ahani/filament-otp-input/master/docs/otp.png)

Number inputs
-------------

[](#number-inputs)

If the number of entries you want is less or more than the default 4 numbers, you can change it according to the example below

```
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;

public function form(Form $form): Form
{
    return $form
        ->schema([
            // ...
            OtpInput::make('otp')
                ->numberInput(6)
                ->label('Otp'),
        ]);
}
```

The above code creates 6 inputs for entering the OTP code.

[![Otp input number](https://raw.githubusercontent.com/hasan-ahani/filament-otp-input/master/docs/otp-number.png)](https://raw.githubusercontent.com/hasan-ahani/filament-otp-input/master/docs/otp-number.png)

Get Code
--------

[](#get-code)

If you need to receive the code after entering it completely, proceed as in the example below

```
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;

public function form(Form $form): Form
{
    return $form
        ->schema([
            // ...
            OtpInput::make('otp')
                ->numberInput(8)
                ->afterStateUpdated(function (string $state){
                    dd($state);
                    // submit form or save record
                })
                ->label('Otp'),
        ]);
}
```

Input type
----------

[](#input-type)

By default, the input type is set to "number". If you need to change it to "password" or "text", you can use the following methods:

```
use HasanAhani\FilamentOtpInput\Components;
use Filament\Forms\Form;

public function form(Form $form): Form
{
    return $form
        ->schema([
            // ...
            OtpInput::make('otp')
                ->password()
                // or
                ->text()
                ->label('Otp'),
        ]);
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/hasan-ahani/filament-otp-input/blob/master/CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Hasan Ahani](https://github.com/hasan-ahani)
- [All Contributors](https://github.com/hasan-ahani/filament-otp-input/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/hasan-ahani/blob/master/LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance46

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.8% 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

Unknown

Total

1

Last Release

420d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/939919859a4e4f8e56b5771bc355135f44d98d8a3926baa6ce4358d2dc090edf?d=identicon)[mokhosh](/maintainers/mokhosh)

---

Top Contributors

[![hasan-ahani](https://avatars.githubusercontent.com/u/67734902?v=4)](https://github.com/hasan-ahani "hasan-ahani (28 commits)")[![sadegh19b](https://avatars.githubusercontent.com/u/54643531?v=4)](https://github.com/sadegh19b "sadegh19b (2 commits)")[![asanovr](https://avatars.githubusercontent.com/u/6459461?v=4)](https://github.com/asanovr "asanovr (1 commits)")[![jacklove315](https://avatars.githubusercontent.com/u/49924120?v=4)](https://github.com/jacklove315 "jacklove315 (1 commits)")[![mokhosh](https://avatars.githubusercontent.com/u/6499685?v=4)](https://github.com/mokhosh "mokhosh (1 commits)")

---

Tags

laravelfilamentfilament-formotp-input

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

320392.1k17](/packages/codewithdennis-filament-select-tree)[hasan-ahani/filament-otp-input

Otp input for filament

2678.1k](/packages/hasan-ahani-filament-otp-input)[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[creagia/filament-code-field

A Filamentphp input field to edit or view code data.

58289.3k3](/packages/creagia-filament-code-field)[ralphjsmit/laravel-filament-components

A collection of reusable components for Filament.

10972.2k2](/packages/ralphjsmit-laravel-filament-components)

PHPackages © 2026

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