Provide some helper services to deal with phone numbers in Silverstripe
This module integrates libphonenumber as the utility to parse and validate
phonenumbers. The fork used is : https://github.com/giggsey/libphonenumber-for-php
Most of the time, it's a good idea to set the country of the phone number.
Otherwise, current locale will be used. If the country is dynamic, you can
set a country field thanks to the setCountryField method.
The value is dynamically formatted through ajax to avoid loading huge js libraries.
You can also easily validate values (for example, with a ZenValidator remote
constraint which targets /libphonenumber/validate url) if needed.
$phone = new LibPhoneNumberField('phone', 'Phone number'); $phone->setCountryCode('BE'); $validator = ZenValidator::create(); $validator->setConstraint('phone', Constraint_remote::create('/libphonenumber/validate',null,array('data' => array('country' => 'BE'))));
This module also provide an extension to apply to dataobject, for example to members
Member: extensions: - LibPhoneNumberExtension
This will add to fields, one "CountryCode" and one "PhoneNumber" to the data object.
You can also make lookups with Twilio provided that you have defined the following constants:
Twilio lookups are accessible through the controller (/libphonenumber/lookup) or
through a static method PhoneNumberExtension::twilioLookup()
Tested with Silverstripe 3.1
LeKoala - [email protected]
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem