Overview
- Rewritten validator class.
- Exposed an expressive Rule class.
- Added an extensive PhoneNumber class for more granular formatting and phone number information.
- Addressed #55 : auto-detection when formatting.
Breaking changes
- The Service Provider is renamed. Please change to
Propaganistas\LaravelPhone\PhoneServiceProvider
. - The Facade to
libphonenumber
is removed in favor of the newPhoneNumber
utility class. If you really need the Facade, just create it yourself. - The validator will now only throw an exception when invalid parameters are encountered. All other erroneous cases such as invalid countries will validate to
false
. - Three additional exceptions may be thrown when formatting a phone number:
Propaganistas\LaravelPhone\Exceptions\NumberParseException
: when the number could not be parsed bylibphonenumber
(e.g. invalid country, no country, ...).Propaganistas\LaravelPhone\Exceptions\NumberFormatException
: when an invalid phone format is provided.Propaganistas\LaravelPhone\Exceptions\CountryCodeException
: when an invalid calling-from country is provided (formatForCountry()
andformatForMobileDialingInCountry()
).