respect-validation/docs/rules/Phone.md

36 lines
736 B
Markdown
Raw Permalink Normal View History

2015-01-30 09:40:06 +01:00
# Phone
- `Phone()`
- `Phone(string $countyCode)`
2015-01-30 09:40:06 +01:00
Validates whether the input is a valid phone number.
2015-01-30 09:40:06 +01:00
```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
```
## Note
When validating with `$countryCode`, this rule will require the `giggsey/libphonenumber-for-php-lite` package.
## Categorization
- Strings
## Changelog
| Version | Description |
|--------:|-------------------------------------|
| 2.3.0 | Introduced a validation per country |
| 0.5.0 | Created |
***
See also:
- [Email](Email.md)
2018-12-11 13:31:50 +01:00
- [Json](Json.md)
- [Url](Url.md)
- [VideoUrl](VideoUrl.md)