respect/validation-locale

此包已被弃用且不再维护。未建议替代包。

一组与本地化一起工作的 Respect\Validation 规则

dev-master / 0.1.x-dev 2015-06-19 02:55 UTC

This package is auto-updated.

Last update: 2023-04-24 01:56:48 UTC


README

一组与本地化一起工作的 Respect.Validation 规则。

国家

  • v::country()
  • v::country(string $set)

根据ISO 3166-1验证国家代码。

v::country()->validate('BR'); //true

默认情况下,我们选择ISO 3166-1 alpha-2,但您也可以使用ISO 3166-1 alpha-3ISO 3166-1 numeric

v::country('alpha-2')->validate('US'); //true
v::country('alpha-3')->validate('USA'); //true
v::country('numeric')->validate('840'); //true

此规则区分大小写。

本规则的所有数据均来自GeoNames,该数据受Creative Commons Attribution 3.0 License许可。

国家子区域

  • v::countrySubdivision(string $entry)

根据ISO 3166-2验证国家代码。

$entry必须是ISO 3166-1 alpha-2格式的国家。

v::countrySubdivision('BR')->validate('SP'); //true
v::countrySubdivision('US')->validate('CA'); //true

此规则区分大小写。

本规则的所有数据均来自GeoNames,该数据受Creative Commons Attribution 3.0 License许可。