mirror of
https://github.com/Respect/Validation.git
synced 2024-05-21 23:56:42 +02:00
cc3bf86b2f
Doing regex on phone numbers is not a great idea. This is a breaking change, but a good one. Phone validation is now much stricter, and allows choosing the country.
33 lines
563 B
Markdown
33 lines
563 B
Markdown
# Phone
|
|
|
|
- `Phone()`
|
|
|
|
Validates whether the input is a valid phone number. This rule requires
|
|
the `giggsey/libphonenumber-for-php-lite` package.
|
|
|
|
|
|
```php
|
|
v::phone()->validate('+1 650 253 00 00'); // true
|
|
v::phone('BR')->validate('+55 11 91111 1111'); // true
|
|
v::phone('BR')->validate('11 91111 1111'); // false
|
|
```
|
|
|
|
## Categorization
|
|
|
|
- Strings
|
|
|
|
## Changelog
|
|
|
|
Version | Description
|
|
--------|-------------
|
|
2.3.0 | Updated to use external validator
|
|
0.5.0 | Created
|
|
|
|
***
|
|
See also:
|
|
|
|
- [Email](Email.md)
|
|
- [Json](Json.md)
|
|
- [Url](Url.md)
|
|
- [VideoUrl](VideoUrl.md)
|