Search by

nowo-tech / otp-input-bundle

HecFranco

Symfony OTP FormType with multi-input UI mapped to a single field value.

Package info

github.com/nowo-tech/OTPInputBundle

Documentation

Language:Shell

Type:symfony-bundle

pkg:composer/nowo-tech/otp-input-bundle

Fund package maintenance!

HecFranco

Statistics

Installs: 1 446

Dependents: 1

Suggesters: 2

Stars: 0

Open Issues: 0

v1.8.2 2026-10-21 11:16 UTC

README

CI Packagist Version Packagist Downloads License PHP Symfony GitHub stars Coverage

Star Found this useful? Install it from Packagist and support the project on GitHub.

Customizable Symfony OTP FormType with multiple visible inputs that map to a single field value.

FrankenPHP Friendly Worker Mode

This bundle is FrankenPHP worker mode friendly.

Table of contents

Features

  • OtpType::class for verification codes (2FA, email confirmation, magic code).
  • Multi-input UI rendered in Twig form themes.
  • Stores data as one string value in your DTO/entity.
  • Customizable length, classes, numeric/alphanumeric mode, and uppercase normalization.
  • TypeScript + Vite assets in src/Resources/assets (named package nowo_otp_input).
  • Paste / SMS autofill (autocomplete="one-time-code" on the first box); translations de, en, es, fr, it, nl, pt.
  • Multi-framework Twig themes (Bootstrap, Tailwind, Foundation, Symfony default).
  • FrankenPHP worker mode verified with FRANKENPHP_RESET_KERNEL=false (sticky Kernel); see the worker audit.

Quick usage

use Nowo\OtpInputBundle\Form\OtpType;

$builder->add('otpCode', OtpType::class, [
    'length' => 6,
    'numeric_only' => true,
    'container_class' => 'd-flex gap-2',
    'input_class' => 'form-control text-center',
    'gap_class' => 'otp-grid',
]);

The value received in otpCode is a single string like 123456.

Demo preview

Empty 6-digit OTP input cells
Empty OTP digit cells
OTP cells filled with a verification code
Code entered across digit cells

Documentation

Additional documentation

Tests and coverage

  • PHP: 100%
  • TS/JS: 97.33% (Vitest; lowest of statements/branches/functions/lines — lines 100%, branches 97.33%; CI gate 90%)
  • Python: N/A