trickeyone / intl-subdivision
一个用于获取指定国家州/省的PHP Intl库。
4.0.0
2022-09-21 22:15 UTC
Requires
- php: ^7.1 || ^8.0
- symfony/intl: ^4.1 || ^5.0 || ^6.0
Requires (Dev)
- ext-json: *
- ext-xdebug: *
- mockery/mockery: ^1.0
- phpunit/phpunit: ^8.0 || ^9.0
- sokil/php-isocodes: ^3.3 || ^4.0
- sokil/php-isocodes-db-i18n: ^4.0
Suggests
- ext-intl: to use the component with locales other than "en"
README
Symfony的Intl组件的配套组件。此组件允许通过国家的ISO 3166-1 alpha-2代码轻松检索国家的州/省。
Symfony Intl组件是C intl扩展的替代品。它仅限于“en”区域设置。如果您想访问更多区域设置,应该安装intl PECL扩展。
使用方法
// States/Provinces for the United States of America $subdivisionsForUS = \Symfony\Component\IntlSubdivision\IntlSubdivision::getStatesAndProvincesForCountry('US'); // States/Provinces for Canada $subdivisionsForCA = \Symfony\Component\IntlSubdivision\IntlSubdivision::getStatesAndProvincesForCountry('CA'); // States/Provinces for the United Arab Emirates $subdivisionsForAE = \Symfony\Component\IntlSubdivision\IntlSubdivision::getStatesAndProvincesForCountry('AE');
需求
- PHP 7+ 或 8+
- Symfony Intl包 5.0+ 或 6.0+
- 较旧版本仍支持4.0+,但不再积极支持