respect-validation/docs/rules/PostalCode.md
Henrique Moody 21aa8eec62
Apply contribution guidelines to "PostalCode" rule
This commit will also remove the second argument from the constructor of
the rule because there is no much use for that, instead if will simply
perform the CountryCode validation.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-17 19:21:14 +01:00

638 B

PostalCode

  • PostalCode(string $countryCode)

Validates whether the input is a valid postal code or not.

v::postalCode('BR')->validate('02179000'); // true
v::postalCode('BR')->validate('02179-000'); // true
v::postalCode('US')->validate('02179-000'); // false
v::postalCode('US')->validate('55372'); // true
v::postalCode('PL')->validate('99-300'); // true

Message template for this validator includes {{countryCode}}.

Extracted from GeoNames.

Changelog

Version Description
0.7.0 Created

See also: