Download the PHP package yaovicoder/intl-region without Composer
On this page you can find all versions of the php package yaovicoder/intl-region. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yaovicoder/intl-region
More information about yaovicoder/intl-region
Files in yaovicoder/intl-region
Package intl-region
Short Description A PHP package for UN M49 region-based country filtering with Symfony integration
License MIT
Informations about the package intl-region
Ydee IntlRegion
A PHP library for filtering localized country lists by UN M49 continent or subregion codes, providing 196 sovereign countries only with comprehensive internationalization support.
Features
- π 196 Sovereign Countries - Clean data with no territories or dependencies
- π Full Internationalization - Country names in any locale via Symfony Intl
- πΊοΈ UN M49 Standard - Official United Nations geographical codes
- π ISO Code Support - Use ISO codes (EUR, AFR, ASI) or UN M49 codes (150, 002, 142)
- π¦ Symfony Bundle - Easy integration with Symfony applications
- π₯οΈ CLI Command - Command-line interface for listing regions
- β Comprehensive Testing - 100% test coverage with validation against UN data
Installation
Via Composer
Manual Installation
-
Clone the repository:
- Install dependencies:
Quick Start
Basic Usage
Symfony Integration
-
Enable the bundle in your
config/bundles.php: -
Configure the bundle in
config/packages/ydee_intl_region.yaml: - Use in your controllers:
API Reference
RegionProvider Class
Constructor
$defaultLocale: Default locale for country names (default: 'en')$logger: PSR-3 logger for error handling (optional)
Core Methods
Get Countries by Continent
Parameters:
$continentCode: Continent code (ISO or UN M49)- ISO codes:
'EUR','AFR','ASI','AMR','OCE' - UN M49 codes:
'150','002','142','019','009'
- ISO codes:
$locale: Locale for country names (optional, uses default if not provided)
Returns: Array of country codes mapped to localized names
Examples:
Get Countries by Subregion
Parameters:
$subregionCode: Subregion code (UN M49)$locale: Locale for country names (optional)
Examples:
Get All Available Countries
Returns: Array of all 196 sovereign country codes
Example:
Check Country Existence
Example:
Get Continent Code for Country
Parameters:
$countryCode: ISO 3166-1 alpha-2 country code$asIsoCode: Return ISO code instead of UN M49 code (default: false)
Examples:
ISO Code Conversion Methods
Available Codes Methods
Supported Codes
Continent Codes
| ISO Code | UN M49 Code | Name |
|---|---|---|
| AFR | 002 | Africa |
| AMR | 019 | Americas |
| ASI | 142 | Asia |
| EUR | 150 | Europe |
| OCE | 009 | Oceania |
Subregion Codes
| UN M49 Code | ISO Code | Name |
|---|---|---|
| 014 | EAF | Eastern Africa |
| 015 | NAF | Northern Africa |
| 017 | MAF | Middle Africa |
| 018 | SAF | Southern Africa |
| 011 | WAF | Western Africa |
| 021 | NAM | Northern America |
| 013 | CAM | Central America |
| 029 | CAR | Caribbean |
| 005 | SAM | South America |
| 030 | EAS | Eastern Asia |
| 034 | SAS | Southern Asia |
| 035 | SEA | South-Eastern Asia |
| 143 | CAS | Central Asia |
| 145 | WAS | Western Asia |
| 151 | EEU | Eastern Europe |
| 154 | NEU | Northern Europe |
| 039 | SEU | Southern Europe |
| 155 | WEU | Western Europe |
| 053 | ANZ | Australia and New Zealand |
| 054 | MEL | Melanesia |
| 057 | MIC | Micronesia |
| 061 | POL | Polynesia |
Country Counts
| Continent | Countries |
|---|---|
| Africa | 54 |
| Asia | 48 |
| Europe | 45 |
| North America | 23 |
| South America | 12 |
| Oceania | 14 |
| Total | 196 |
CLI Usage
The library includes a Symfony console command for listing regions:
Error Handling
The library provides graceful error handling with logging:
Testing
Run the test suite:
Data Validation
The library includes validation against official UN M49 data:
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for a list of changes and version history.
Data Sources
- UN M49 Standard: Official UN geographic codes
- Symfony Intl: Localization and country data
All versions of intl-region with dependencies
psr/log Version ^3.0
symfony/intl Version ^6.0|^7.0
symfony/console Version ^6.0|^7.0
symfony/dependency-injection Version ^6.0|^7.0
symfony/config Version ^6.0|^7.0