respect-validation/docs/PostalCode.md

21 lines
485 B
Markdown
Raw Normal View History

2015-01-30 09:40:06 +01:00
# PostalCode
- `v::postalCode(string $countryCode)`
Validates a postal code according to the given country code.
```php
v::numeric()->postalCode('BR')->validate('02179000'); // true
v::numeric()->postalCode('BR')->validate('02179-000'); // true
v::numeric()->postalCode('US')->validate('02179-000'); // false
2015-01-30 09:40:06 +01:00
```
Message template for this validator includes `{{countryCode}}`.
2015-01-30 09:40:06 +01:00
Extracted from [GeoNames](http://www.geonames.org/).
***
2015-01-30 09:40:06 +01:00
See also:
* [CountryCode](CountryCode.md)