openbuildings / monetary
Useful tool for formatting and converting currencies
Installs: 206 483
Dependents: 1
Suggesters: 1
Security: 0
Stars: 9
Watchers: 12
Forks: 4
Open Issues: 5
Requires
- php: ^7.1
- ext-curl: *
- ext-simplexml: *
- desarrolla2/cache: 1.6.*
Requires (Dev)
- phpunit/phpunit: ^7
README
Useful tool for formatting and converting currencies in PHP
The main features are:
- formatting an amount in a certain currency;
- converting an amount from one currency to another.
The Monetary library takes care of fetching exchange rates from remote services and caching them.
You can easily use your own exchange rates source or cache solution.
Installation
Install via Composer
composer require openbuildings/monetary
Basic Usage
Use the namespace:
use OpenBuildings\Monetary\Monetary;
then just convert and format currencies:
echo Monetary::instance()->convert(10, 'USD', 'GBP'); // 7.5091987684914 echo Monetary::instance()->format(15.3, 'GBP'); // £15.30