mpetrini/intl-tel-input-bundle
Symfony bundle for integrating intl-tel-input into PHP applications. Adds an international telephone input with country flags, automatic formatting, and client-side validation, making phone number collection in forms easier and more consistent. Configurable assets and form helpers streamline setup.
composer require mpetrini/intl-tel-input-bundle. In Symfony 4, register the bundle in config/bundles.php if Flex does not do it automatically.Form/Type/, Resources/config/, Resources/views/Form/, and Resources/public/. Those tell you whether it exposes a custom form type, a form type extension, a Twig form theme, or prebuilt assets.intl-tel-input, but most teams will want to install intl-tel-input via npm/yarn and include it through Webpack Encore or a CDN.intlTelInput in JavaScript, and submit an E.164-formatted value to the server.$builder->add('phone', IntlTelInputType::class, [
'initial_country' => 'us',
'preferred_countries' => ['us', 'gb', 'de'],
]);
If the bundle only provides a type extension, add the option to a normal TextType or TelType instead.intlTelInput.getNumber() and write the E.164 result into the hidden field before the form posts.intl-tel-input validation is a convenience only. Use giggsey/libphonenumber-for-php in a custom constraint or form event to validate and reformat the submitted number.intlTelInput after the field is inserted into the DOM. The plugin binds to an existing input element, so replacing HTML requires a new call.+14155552671) and keep the country code separately only if your domain needs it. This avoids ambiguity when users change the country selector.intl-tel-input version may be old. If you need current country data, formatting, or accessibility fixes, install the npm package and override the bundle’s assets.background-image path.utils.js is loaded if you rely on formatting or validation helpers. Many “undefined is not a function” errors come from missing utils rather than the core plugin.setNumber() or set the input’s value, then trigger the plugin’s country detection. Otherwise, editing an existing record can show the wrong country.getNumber() or a hidden field updated on countrychange and blur.data-* attributes and checking the browser console for intlTelInput is not defined. If the bundle silently renders a plain input, its form theme block or asset include is probably not active.How can I help you explore Laravel packages today?