Download the PHP package eonx-com/currencies without Composer

On this page you can find all versions of the php package eonx-com/currencies. 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 currencies

Currencies

This library allows currencies to be found by ISO4217 code or numeric identifier and formatted for display based on different locales.

This library comes in three main parts: currencies, locales and a translator.

Currencies

Currencies are simple files made up of:

Property Description
Minor unit The number of decimal places the currency uses, e.g. 2 for Australian Dollar
Name The currency name, e.g. Australian Dollar
Numeric code The ISO4217 numeric code, e.g. 036 for Australian Dollar
Symbol The UTF-8 currency symbol, e.g. $

The currency class name is the ISO4217 alpha code in PSR-2 format, e.g. Aud for Australian Dollar.

Finding a currency

You can find a currency using the ISO4217 class. This class provides two methods:

Method Description
find($code): CurrencyInterface Find a currency by alpha* or numeric code
getSupportedAlphaCodes(): array Get a list of supported alpha codes

* Alpha code is case insensitive

Note: Not all currencies are currently supported, more currencies will be added as soon as possible, optionally you can open a pull request to add currencies you require.

Working with a currency

If a currency is successfully found you will recieve a currency object back with the following methods:

Method Description
getAlphaCode(): string Get the alpha code for the currency
getMinorUnit(): int Get the number of decimal places the currency uses
getName(): string Get full name for the currency
getNumericCode(): string Get the ISO4217 numeric code for the currency
getCurrencySymbol(): string Get the UTF-8 symbol for the currency

Locales

Locales are also simple files made up of:

Property Description
Identifier The IETF language tag of the locale, e.g. en-AU for Australian English
Currency format How to format a currency using symbol replacement, e.g. '-¤ #' for Australian English
Decimal separator How decimals are represented in numeric displays, e.g. period for Australian English
Negative symbol The negative symbol used by this locale, e.g. hyphen for Austrlaian English
Numeric format How to format a numeric value using symbol replacement, e.g. '-#' for Australian English
Thousands separator The separator used to group thousands together, e.g. comma for Australian English

Why not php-intl?

This code seems to duplicate what php-intl provides with the NumberFormatter class however this extension works differently on different operating systems and locales which causes formatted numbers and currencies to be inconsistent. The symfony/intl package only provides support for en-US or falls back to php-intl if it's installed which causes the same issues.

This library provides consistenty across all operating systems independently of php-intl when it comes to formatting numbers or currencies for display.

Finding a locale

You can find a currency using the Translator class. This class provides two methods:

Method Description
find($code): LocaleInterface Find a locale by IETF language code*
getSupportedLocales(): array Get a list of supported IETF language codes

* IETF is case insensitive and ignores special characters: en-au, en_AU, enAu and en((au will all resolve correctly

Note: Not all locales are currently supported, more locales will be added as soon as possible, optionally you can open a pull request to add locales you require.

Working with a locale

If a locale is successfully found you will recieve a locale object back with the following method:

Method Description
getIdentifier(): string Get the IETF language code for the current locale

Formatting

The real use of this class is to format numbers and currencies based on locale, this is done via for Formatter class which provides four methods:

Method Description
currency(string $locale): string Get the amount formatted using the precision and symbol from the currency displayed based on an IETF locale language code
decimal(): string Get the amount formatted using the precision from the currency, e.g. 2 decimal places for Australian Dollar
numeric(string $locale): string Get the amount formatted using the precision from the currency displayed based on an IETF locale language code

When instantiating the formatter an amount and ISO4217 alpha or numeric code must be passed to the constructor.

Note: Arabic may not be displayed correctly due to RTL formatting of the output.


All versions of currencies with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 eonx-com/currencies contains the following files

Loading the files please wait ....