Download the PHP package sokil/php-isocodes without Composer

On this page you can find all versions of the php package sokil/php-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 php-isocodes

Stand With Ukraine 🇺🇦

SWUbanner


PHP ISO Codes

Continuous integration Latest Stable Version Coverage Status Total Downloads Daily Downloads

:star: This library used to get localized names of countries, currencies, languages and scripts.

:package: Based on Python's pycountry and Debian's iso-codes.

:tongue: Current translation status: https://salsa.debian.org/iso-codes-team/iso-codes#status-of-translations

Table of contents

ISO Standards

Installation

You may use this library in different modes:

💾 Library with included database and localization

To install library with database and i18n:

Latest Stable Version Total Downloads Daily Downloads

💾 Library with included database and without localization

You may also install library with only database (no i18n will be available):

Latest Stable Version Total Downloads Daily Downloads

💾 Library without database and localization, requires manual database installation and updates

You can install library through Composer:

Database and gettext files located in related packages inside databases and messages directories. This packages periodically updated with package version increment.

If you want to update database, use script ./bin/update_iso_codes_db.sh. Call this script by cron, during deploy process or when build your docker image.

Argument Required Description
mode Required May be "all" or "db_only". In "all" mode update database (json files) and locallisation (po and mo files), in "db_only" only database will update
base_dir Required Dir where to place database and messages \
build_dir Optional. Default: "/tmp/iso-codes-build" Dir where source directory cloned and files original files processed.

Now you need to configure factory to use this directory:

Translation drivers

Translation drivers required when need to get local names of iso entities.

Translation driver must implement Sokil\IsoCodes\TranslationDriver\TranslationDriverInterface.

Instance of driver may be passed to IsoCodesFactory. If it not passed, default GettextExtensionDriver will be used.

Gettext extension driver

This is default translation driver. It requires ext-gettext.

Locale configuration

Before using IsoCodes database you need to setup valid locale to get translations worked, because ext-gettext uses system local, configured by setlocale.

To get list of available locales, execute under console:

If you don't see required locales in list, you may install them manually (for Ubuntu):

Symfony Translation driver

Dummy driver

This driver may be used, when localisation of names does not require, and only database of codes is required.

Usage

Factory

All databases may be created through factory:

There are large databases: subdivisions and languages. Loading of entire database into memory may require lot of RAM and time to create all entries in memory.

So there are scenarios of usage: with optimisations of memory and with optimisation of time.

Memory optimisation

Database splits into partition files.

Fetching some entry will load only little part of database. Loaded entries not stored statically.

This scenario may be useful when just few entries need to be loaded, for example on web request when one entry fetched.

This may require a lot of file read operations.

Input-output optimisations

Entire database loaded into memory from single JSON file once.

All entries created and stored into RAM. Next read of save entry will just return it without io operations with files and building objects.

This scenario may be useful for daemons to decrease file operations, or when most entries will be fetched from database.

This may require a lot of RAM for storing all entries.

Countries database (ISO 3166-1)

Country contains next names:

Name Description Example
Name Required Moldova, Republic of
Official Name Optional Republic of Moldova
Common Name Optional Moldova
Localised Name Optional Молдова

This names may be get from country entity:

Also you may get flag of country:

Get localized name of country by it's alpha2 code:

Get localized name of country by it's alpha2 code:

Get localized name of country by it's numeric code:

Get localised list of countries

Subdivisions database (ISO 3166-2)

Historic countries database (ISO 3166-3)

Scripts database (ISO 15924)

Currencies database (ISO 4217)

Languages database (ISO 639-3)

Tests

To start docker tests run following command:

For example for PHP 7.1 run following command:

See also


All versions of php-isocodes with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
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 sokil/php-isocodes contains the following files

Loading the files please wait ....