Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trickeyone/intl-subdivision
IntlSubdivision Component - Retrieve State/Province Information
https://github.com/trickeyone/intl-subdivision
country country-codes intl-extension intl-subdvision php province provinces state states subdivision symfony symfony-intl-component
Last synced: about 1 month ago
JSON representation
IntlSubdivision Component - Retrieve State/Province Information
- Host: GitHub
- URL: https://github.com/trickeyone/intl-subdivision
- Owner: trickeyone
- Created: 2016-11-08T03:13:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-23T19:13:12.000Z (about 1 year ago)
- Last Synced: 2024-04-24T08:29:39.684Z (7 months ago)
- Topics: country, country-codes, intl-extension, intl-subdvision, php, province, provinces, state, states, subdivision, symfony, symfony-intl-component
- Language: PHP
- Homepage:
- Size: 282 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
IntlSubdivision Component
=============[![PHPUnit](https://github.com/trickeyone/intl-subdivision/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/trickeyone/intl-subdivision/actions/workflows/unit-tests.yml)
![code coverage badge](https://raw.githubusercontent.com/trickeyone/intl-subdivision/gh-images/coverage.svg)
[![Test Coverage](https://codeclimate.com/github/trickeyone/intl-subdivision/badges/coverage.svg)](https://codeclimate.com/github/trickeyone/intl-subdivision/coverage)
[![Code Climate](https://codeclimate.com/github/trickeyone/intl-subdivision/badges/gpa.svg)](https://codeclimate.com/github/trickeyone/intl-subdivision)A companion component to Symfony's Intl Component. This component allows for easy retrieval of a country's states/provinces
using the country's [ISO 3166-1 alpha-2][0] code.The Symfony Intl component is a replacement for the C intl extension. It is limited to only the "en" locale. If you want
to have access to more locales you should [install the intl PECL extension][1].### Usage:
```php
// 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');
```Requirements
-----------
* PHP 7+ or 8+
* Symfony Intl package 5.0+ or 6.0+
* older versions can still support 4.0+ but are not actively supportedResources
---------* [Symfony Intl Documentation](https://symfony.com/doc/current/components/intl.html)
* [Report issues](https://github.com/trickeyone/intl-subdivision/issues) and
[send Pull Requests](https://github.com/trickeyone/intl-subdivision/pulls)[0]: http://www.iso.org/iso/home/standards/country_codes.htm
[1]: http://www.php.net/manual/en/intl.setup.php