mokhosh/filament-otp-input
A Filament form field for entering one-time passwords, rendering separate digit boxes for smooth OTP and PIN entry in your admin panels.
Install the package with Composer, then make sure Filament’s assets are refreshed if the OTP field does not render correctly:
composer require mokhosh/filament-otp-input
php artisan filament:assets
php artisan optimize:clear
Start by reading the package README, then inspect the component class and Blade view in src/ and resources/views/. At v1.0.0 this is the initial release, so the README is the authoritative source for the exact component namespace and supported fluent methods.
The first practical use case is a Filament verification form: add an OTP field, submit it to a Livewire action, and validate the code server-side before marking the user/email/phone as verified.
use Mokhosh\FilamentOtpInput\Forms\Components\OtpInput; // confirm namespace from README
OtpInput::make('otp')
->label('Verification code')
->length(6)
->required();
Treat the field as an input widget only. The real verification logic should live in your application action or service.
Use the OTP input as part of a small verification workflow rather than as a standalone security mechanism:
A typical Filament form field setup:
OtpInput::make('otp')
->label('One-time code')
->length(6)
->required()
->rules(['digits:6']);
Pair the field with explicit actions:
use Filament\Forms\Components\Actions\Action;
Action::make('sendOtp')
->label('Send code')
->action(fn () => $this->sendOtp());
Action::make('verifyOtp')
->label('Verify')
->action(fn () => $this->verifyOtp());
Implementation tips:
digits: rules when the code is numeric, or a regex rule if the package supports alphanumeric codes.expires_at, attempts, and last_sent_at fields.wire:key to avoid Livewire state issues.^1.0 and review the changelog before upgrading, especially once the public API expands.php artisan filament:assets and clear cached views/config.autocomplete="one-time-code" or inputmode="numeric" support; check whether the package exposes those options or whether you need to customize the view.How can I help you explore Laravel packages today?