nowo-tech / phone-input-bundle
Symfony bundle providing a phone form type with optional country prefix selector and flexible value formats
Package info
github.com/nowo-tech/PhoneInputBundle
Type:symfony-bundle
pkg:composer/nowo-tech/phone-input-bundle
Fund package maintenance!
Requires
- php: >=8.2 <8.6
- symfony/form: ^6.4 || ^7.0 || ^8.0
- symfony/framework-bundle: ^6.4 || ^7.0 || ^8.0
- symfony/twig-bundle: ^6.4 || ^7.0 || ^8.0
- symfony/validator: ^6.4 || ^7.0 || ^8.0
- twig/extra-bundle: ^3.12
- twig/string-extra: ^3.12
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- giggsey/libphonenumber-for-php: ^8.0 || ^9.0
- igor-php/igor-php: ^0.10.0
- nowo-tech/phpstan-frankenphp: ^1.0
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.0
- rector/rector: ^2.0
- symfony/asset: ^6.4 || ^7.0 || ^8.0
- symfony/dependency-injection: ^6.4 || ^7.0 || ^8.0
- symfony/http-kernel: ^6.4 || ^7.0 || ^8.0
- symfony/translation: ^6.4 || ^7.0 || ^8.0
- symfony/yaml: ^6.4 || ^7.0 || ^8.0
- vincentlanglet/twig-cs-fixer: ^4.0
Suggests
- giggsey/libphonenumber-for-php: Optional E.164 validation and formatting via libphonenumber
- symfony/http-client: Required by symfony/ux-icons to fetch Iconify icons unless icons are locked locally
- symfony/ux-icons: Optional SVG country flags via ux_icon (circle-flags:xx) in flag_display=UX_ICON mode
Provides
None
Conflicts
None
Replaces
None
README
⭐ Found this useful? Give it a star on GitHub so more developers can find it.
Symfony bundle providing a phone form type with optional country prefix selector and flexible value formats (E.164 string, separated array, or PhoneNumber value object).
This bundle is FrankenPHP worker mode friendly.
Worker mode is supported including reset_kernel: false (long-lived kernel). See docs/FRANKENPHP-WORKER-AUDIT.md.
Full demo — prefix closed |
Full demo — prefix picker open |
Features
- Extends Symfony
TelTypewith an optional country prefix selector (flags, dial codes, autocomplete search) - Three model formats: CONCATENATED (E.164), SEPARATED (array), OBJECT (
PhoneNumberVO) - Validation by country ISO, dial prefix, or disabled (
phone_validation) - Configurable prefix/flag display modes and CSS classes (Bootstrap, Tailwind, Foundation, custom)
- Bundled country catalog and CSS flag icons; optional UX Icons for SVG flags
- CSP-safe prefix picker (
nowo-phone-prefix-picker.jsIIFE): no inline scripts; Stimulus-compatible markup; portaled dropdown; progressive enhancement
Quick start
composer require nowo-tech/phone-input-bundle
use Nowo\PhoneInputBundle\Form\Type\PhoneType; $builder->add('mobile', PhoneType::class);
See docs/INSTALLATION.md for form theme, CSS assets, and optional dependencies.
Requirements
- PHP >= 8.2, < 8.6
- Symfony ^6.4 || ^7.0 || ^8.0
Demo
Demos for Symfony 7.0 and 8.0 live under demo/. From the bundle root:
make -C demo up-symfony8
# http://localhost:8003 (see demo/symfony8/.env.example)
The demo page shows 20 field examples and a CSS framework selector (?framework=bootstrap5|tailwind2|foundation6|symfony-default). See demo/README.md.
Demos use FrankenPHP without worker mode in development (changes visible on refresh). For production worker setup, see docs/DEMO-FRANKENPHP.md.
Development
make -C demo/symfony8 test-e2e
make -C demo/symfony8 demo-screenshots # refreshes docs/images/demo/*.webp
make up && make install && make test make test-coverage # PHP coverage report make release-check # cs-fix, phpstan, coverage, demo healthchecks
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
- GitHub Actions CI requirements
- PSR evaluation (REQ-CS-007)
- FrankenPHP worker audit (
reset_kernel: false) - Demo with FrankenPHP (development and production)
- Overriding bundle templates
- Branching
Tests and coverage
- Tests: PHPUnit (unit + integration)
- PHP: 99.74% (753/755 lines)
- TS/JS: N/A
- Python: N/A
License
MIT — see LICENSE.
Author
Created by Nowo.tech


