Download the PHP package php-components/isocodes without Composer

On this page you can find all versions of the php package php-components/isocodes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package isocodes

PHP ISO Codes

Build Status

PHP ISO codes based on the open source iso-codes project.

This project includes:

...and the appropiate translations which are managed through the Translation Project.

Installation

The easiest and recommended way to install this library is through composer:

composer require php-components/isocodes

Adapters

Adapters are used in order to load the ISO data. Currently we support the following adapters:

However there are interfaces in place so you can write your own custom adapter. If you write your own adapter keep in mind it must inject the translator object into the objects.

The get($code) will determine which type of code has been supplied as an argument and will search for that type of code. The allowed types are the Alpha-2, Alpha-3, Alpha-4 and Numeric codes (If available in the requested ISO).

Some ISO files, such as ISO-639 have additional codes that match the pattern of Alpha-2, Alpha-3, Alpha-4 or Numeric codes. For those special cases an additional method is added to their adapters.

JSON Adapter

This adapter makes use of iso-codes JSON files to provide the ISO data. The data is stored as an array inside the adapter interfaces.

Usage Example:

use ISOCodes\ISO3166_1\Adapter\Json as ISO3166_1Adapter;

$adapter = new ISO3166_1Adapter();
// Get country with Alpha-2 code 'es' (Spain)
$country = $adapter->get('es');

if (null !== $country) {
    // Get the country name in Spanish ('es')
    echo $country->getName('es');
} else {
    echo 'Country not found!';
}

This shall return España

PDO Adapter

This adapter makes use of PDO to retrieve the ISO data from a database backend. By default it will use the included SQLite database but you may specify another PDO in the constructor of the adapter. The constuctor is defined as follows:

public function __construct(PDO $pdo = null)

$pdo will be you PDO object or you can leave it as null in order to load the default SQLite database.

Usage Example

use ISOCodes\ISO3166_1\Adapter\Pdo as ISO3166_1Adapter;

$adapter = new ISO3166_1Adapter();
// Get country with Alpha-2 code 'es' (Spain)
$country = $adapter->get('es');

if (null !== $country) {
    // Get the country name in Spanish ('es')
    echo $country->getName('es');
} else {
    echo 'Country not found!';
}

This shall return España


All versions of isocodes with dependencies

PHP Build Version
Package Version
Requires php Version ^5.4 || ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-components/isocodes contains the following files

Loading the files please wait ....