- What is ysfkaya/filament-phone-input and what does it add to Filament?
- It is a Composer package that provides an international phone input component for Laravel Filament 3.x. It ships a form field (PhoneInput), a table column (PhoneColumn) and an infolist entry (PhoneEntry), so phone numbers can be captured, validated and displayed consistently across your panel. Behind the scenes it uses the intl-tel-input JavaScript library on the client and Laravel Phone on the server for parsing, formatting and validation.
- How do I install filament-phone-input in a Laravel application?
- Install it with Composer using composer require ysfkaya/filament-phone-input. The service provider is auto-discovered, so no manual registration is needed. The frontend assets are published through Filament's own asset pipeline, so you may need to run php artisan filament:assets after installing or upgrading. Your project needs PHP 8.1 or newer and Filament 3.x.
- Which PHP, Laravel and Filament versions does filament-phone-input support?
- The package requires PHP 8.1 or higher and targets Filament 3.x, which is the standard stack for modern Laravel applications. It extends Filament's form, table and infolist components and relies on Laravel Phone (v10+) for the server-side number handling. Filament 4 support is not part of the current release, so check the repository before planning a panel upgrade.
- How do I validate phone numbers with the Filament phone input?
- Validation is handled server-side by Laravel Phone, so numbers are parsed and checked against real numbering plans rather than only by the browser. You can attach the package's rules, or standard Laravel Phone rules, to the field and optionally enable strict mode to reject numbers missing a country code. Client-side checks from intl-tel-input give fast feedback, but the server-side rules are what protect your data. If your database already contains numbers without country codes, normalise them or use lenient validation before turning strict mode on.
- How do I set a default country or disable the GeoIP lookup?
- By default the component tries to guess the visitor's country through a GeoIP lookup, which can be slow or fail on private networks and air-gapped servers. You can pin a starting country with the defaultCountry option, and call disableLookup() when you want no GeoIP request at all. Disabling the lookup is recommended for internal tools and for pages where latency matters.
- How do I store the country code in a separate database column?
- The component can split the dial code from the national number and write it to a second field using the countryStatePath option, which should point at the matching form field name. That lets you keep a dedicated country column while the main attribute stores the phone number itself. You will need to add the extra column to your table and include it in your model's fillable attributes. If you prefer a single column, store the number in E.164 instead.
- How do I change the format used to display phone numbers in tables and infolists?
- PhoneColumn and PhoneEntry render numbers using the format you configure, so you can show E.164 (+15551234567), national (555-123-4567) or RFC3966 (tel:+1-555-123-4567) output. The input side has its own format setting, which controls what the user sees while typing. You can also pass a locale so numbers follow regional conventions.
- Can I restrict the list of allowed countries or customise intl-tel-input options?
- Yes. The component accepts closures for behaviour such as allowed countries and per-field validation rules, so you can tailor it inside a resource without touching package code. The customOptions method passes an array straight through to the underlying intl-tel-input instance, giving you its full option set. That covers cases like limiting the dropdown to a target market or adjusting how the country selector behaves.
- Does the intl-tel-input JavaScript bundle hurt page performance?
- The underlying intl-tel-input library is fairly heavy, at roughly 200KB gzipped, so it can measurably affect load time on mobile or low-bandwidth connections. Because the assets are registered through Filament, they load with your panel rather than on every page of the site. If initial load matters, keep the component off non-essential screens and measure Largest Contentful Paint before shipping.
- Is filament-phone-input maintained, and should I use Laravel Phone directly instead?
- The package is a thin, self-contained wrapper around Laravel Phone and intl-tel-input, so you can drop it and use those libraries directly if maintenance ever stalls. Using Laravel Phone alone gives you validation and formatting, but leaves you to build the Filament field, column and asset wiring yourself. Before adopting it, check recent commits and releases, and track whether a Filament 4 compatible version has been published.