Download the PHP package m-adamski/symfony-phone-number-bundle without Composer
On this page you can find all versions of the php package m-adamski/symfony-phone-number-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download m-adamski/symfony-phone-number-bundle
More information about m-adamski/symfony-phone-number-bundle
Files in m-adamski/symfony-phone-number-bundle
Package symfony-phone-number-bundle
Short Description Bundle for Symfony which integrates with the libphonenumber library
License MIT
Rated 5.00 based on 1 reviews
Informations about the package symfony-phone-number-bundle
PhoneNumber Bundle for Symfony
Custom PhoneNumber Bundle integrating libphonenumber library into Symfony project. This bundle is inspired by PhoneNumberBundle but simplified and created for own projects.
Installation
Use Composer to install this bundle into Symfony project:
Configuration
This Bundle provide type template for Bootstrap 5. Register it in config/packages/twig.yaml
How to use it?
Bundle provide additional Doctrine Type and Form Type. First, edit entity to use PhoneNumber Type:
An additional Doctrine Type has been removed from the bundle, because its use caused a problem with logging changes to the entity. Phone number is now stored in the database as string.
Now it's time to provide changes in Form Type:
There are some additional options that you can use:
- countries - array of available countries e.g. ["PL", "DE"]
- preferred - array or string with preferred country or countries
- country_attr - attributes for country input
- number_attr - attributes for number input
- countries_renderer - a function that returns a string displayed as a country selection option. The following parameters are available: countryName, countryCode, regionCode
Twig filter
The displayed phone number in the template can be formatted according to the given pattern.
For this purpose, the Twig phone_number
filter has been implemented.
License
MIT
All versions of symfony-phone-number-bundle with dependencies
ext-json Version *
ext-mbstring Version *
giggsey/libphonenumber-for-php Version ^8.13
symfony/form Version ^7.0
symfony/framework-bundle Version ^7.0
symfony/intl Version ^7.0
symfony/twig-bundle Version ^7.0
symfony/validator Version ^7.0