Download .zip |
Info | Example | View files (4) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2019-02-19 (5 hours ago) | Not enough user ratings | Total: 382 This week: 19 | All time: 6,537 This week: 28 |
Version | License | PHP version | Categories | |||
php-countries-array 1.0.8 | GNU General Publi... | 5.3.0 | PHP 5, Statistics, Geography |
Description | Author | |
This class can get the names and codes of all world countries. |
PHP class to get array of countries with ISO_3166-1, ISO_3166-2 and ISD codes it can provide following information related to the country
Include CountryArray.php in your php code and you its ready to use.
Add the package to your composer.json and run composer update.
{
"require": {
"sameer-shelavale/php-countries-array": "*"
}
}
Get simple key-value array by default it returns alpha2 => name pairs
$countries = CountriesArray::get();
Include non iso countries:
$countries = CountriesArray::iso(false)->get();
Get key values pairs
$countries = CountriesArray::get( 'alpha2', 'name' ); // returns alpha2->name array
$countries = CountriesArray::get( 'num', 'alpha3' ); // return numeric-codes->alpha3 array
$countries = CountriesArray::get( 'num', 'name' ); // return numeric-codes->name array
Get only values without keys
$countries = CountriesArray::get( null, 'name' ); // return array of country names
$countries = CountriesArray::get( null, 'alpha2' ); // return array of alpha2 codes
Get 2d array
$countries = CountriesArray::get2d( null, 'name' ); // return array of country names
$countries = CountriesArray::get2d( null, 'alpha2' ); // return array of alpha2 codes
Get countries filtered by continent
$countries = CountriesArray::getFromContinent( 'alpha2', 'name', 'Africa' ); // returns alpha2->name array of countries from Africa
$countries = CountriesArray::getFromContinent( 'num', 'alpha3', 'Asia' ); // return numeric-codes->alpha3 array of countries from Asia
$countries = CountriesArray::getFromContinent( 'num', 'name', 'Europe' ); // return numeric-codes->name array of countries from Europe
Do not use ISD code(isd) and continent as key fields, as there are multiple records for them
Files |
File | Role | Description | ||
---|---|---|---|---|
sample (1 file) | ||||
src (1 file) | ||||
composer.json | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.