mirror of
https://github.com/Respect/Validation.git
synced 2024-05-18 14:16:41 +02:00
5450ef86a8
Since we already have that library as a dependency of our repository, it makes sense to use it as a source of language codes instead of keeping a list of currencies ourselves. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
37 lines
742 B
Markdown
37 lines
742 B
Markdown
# LanguageCode
|
|
|
|
- `LanguageCode()`
|
|
- `LanguageCode(string $set)`
|
|
|
|
Validates whether the input is language code based on ISO 639.
|
|
|
|
```php
|
|
v::languageCode()->validate('pt'); // true
|
|
v::languageCode()->validate('en'); // true
|
|
v::languageCode()->validate('it'); // true
|
|
v::languageCode('alpha-3')->validate('ita'); // true
|
|
v::languageCode('alpha-3')->validate('eng'); // true
|
|
```
|
|
|
|
You can choose between `alpha-2` and `alpha-3`; `alpha-2` is set by default set.
|
|
|
|
This rule uses data from [sokil/php-isocodes][].
|
|
|
|
## Categorization
|
|
|
|
- ISO codes
|
|
- Localization
|
|
|
|
## Changelog
|
|
|
|
Version | Description
|
|
--------|-------------
|
|
1.1.0 | Created
|
|
|
|
***
|
|
See also:
|
|
|
|
- [CountryCode](CountryCode.md)
|
|
|
|
[sokil/php-isocodes]: https://github.com/sokil/php-isocodes
|