mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 23:35:45 +01:00
I want to avoid having the Factory inside the rules. If a rule needs to create another, it can simply instantiate that. The "KeyValue" rule does too many things under the hood, and the behavior can be unpredictable. The "LazyConsecutive" rule makes the validation more explicit and way more flexible, as there could be other cases in which someone only wants to validate something if the previous validator passes. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
1.1 KiB
1.1 KiB
SubdivisionCode
SubdivisionCode(string $countryCode)
Validates subdivision country codes according to ISO 3166-2.
The $countryCode must be a country in ISO 3166-1 alpha-2 format.
This rule requires sokil/php-isocodes and [php-isocodes-db-only][] to be installed.
v::subdivisionCode('BR')->validate('SP'); // true
v::subdivisionCode('US')->validate('CA'); // true
Categorization
- ISO codes
- Localization
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Require sokil/php-isocodes and sokil/php-isocodes-db-only |
| 1.0.0 | Created |
See also: