Download the PHP package bentools/currency without Composer

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

Latest Stable Version License Build Status Coverage Status Quality Score Total Downloads

A very simple, framework-agnostic, PHP library to work with currencies.

Install

composer require bentools/currency:1.0.x-dev

Example use

bentools/currency respects SOLID principles. So feel free to implement your own:

Online rate providers

We provide adapters for popular API providers:

* Only free plans are currently supported by the built-in adapters. Feel free to submit a PR for supporting paid plans.

Chained exchange rate provider

This provider allow you to chain providers. The 1st one which returns a result wins.

Average exchange rate provider

Get an average exchange rate from different providers. If you provide a tolerance, an exception will be thrown if the difference between the lowest and the highest rate exceeds it.

PSR-16 provider

Cache your exchange rates for the duration of your choice with the PSR-16 decorator:

Doctrine ORM provider

If you store your own exchange rates with Doctrine ORM, the built-in implementation may help:

Framework agnostic

bentools/currency leverages HttpPlug to connect to the APIs. This means:

Don't forget that most free plans limit to 1000 calls/month, so you'd better configure your Http Client to cache responses. If you use Guzzle 6+, have a look at kevinrob/guzzle-cache-middleware

Tests

./vendor/bin/phpunit

License

MIT

Disclaimer

This library is intended to be easy to use, and aims at covering most common needs. To achieve this, it uses floats as type hints (but you're free to store as integers and convert back).

Keep in mind that working with floats can lead to inaccurate results when dealing with a big number of digits. Read this for further information.

In short, avoid dealing with big integers or a high number of decimals when using this library if precision matters.


All versions of currency with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
bentools/querystring Version ^1.0
php-http/discovery Version ~1.0
php-http/httplug Version ~1.0|~2.0
php-http/message Version ~1.6
php-http/message-factory Version ~1.0
psr/simple-cache Version ^1.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 bentools/currency contains the following files

Loading the files please wait ....