mirror of
https://github.com/Respect/Validation.git
synced 2024-05-18 14:16:41 +02:00
f9b9dd21f9
Since "sokil/php-isocodes" is a dependency of our repository already, it makes sense to use it as a source of currency codes instead of keeping a list of currencies ourselves. By using that library, we can also validate currency codes using different sets. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
36 lines
716 B
Markdown
36 lines
716 B
Markdown
# CurrencyCode
|
|
|
|
- `CurrencyCode()`
|
|
- `CurrencyCode(string $set)`
|
|
|
|
Validates an [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code like GBP or EUR.
|
|
|
|
```php
|
|
v::currencyCode()->validate('GBP'); // true
|
|
v::currencyCode('alpha-3')->validate('EUR'); // true
|
|
v::currencyCode('numeric')->validate('840'); // true
|
|
```
|
|
|
|
This rule uses data from [sokil/php-isocodes][].
|
|
|
|
## Categorization
|
|
|
|
- ISO codes
|
|
- Localization
|
|
|
|
## Changelog
|
|
|
|
Version | Description
|
|
--------|-------------
|
|
2.2.0 | Allow to use different sets
|
|
2.0.0 | Became case-sensitive
|
|
1.0.0 | Created
|
|
|
|
***
|
|
See also:
|
|
|
|
- [CountryCode](CountryCode.md)
|
|
- [SubdivisionCode](SubdivisionCode.md)
|
|
|
|
[sokil/php-isocodes]: https://github.com/sokil/php-isocodes
|