Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/redco/redcode-currency-rate
Lib for loading currency rates
https://github.com/redco/redcode-currency-rate
Last synced: 8 days ago
JSON representation
Lib for loading currency rates
- Host: GitHub
- URL: https://github.com/redco/redcode-currency-rate
- Owner: redco
- Created: 2013-04-28T09:26:42.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-11-20T10:46:19.000Z (almost 9 years ago)
- Last Synced: 2024-10-14T00:19:59.651Z (about 1 month ago)
- Language: PHP
- Size: 65.4 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Currency Rates converter library [![Latest Stable Version](https://img.shields.io/packagist/v/redcode/currency-rate.svg?style=flat)](https://packagist.org/packages/redcode/currency-rate) [![Total Downloads](https://img.shields.io/packagist/dt/redcode/currency-rate.svg?style=flat)](https://packagist.org/packages/redcode/currency-rate)
[![Build Status](https://img.shields.io/travis/redco/redcode-currency-rate.svg?style=flat)](https://travis-ci.org/redco/redcode-currency-rate)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/redco/redcode-currency-rate.svg?style=flat)](https://scrutinizer-ci.com/g/redco/redcode-currency-rate/?branch=master)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/redco/redcode-currency-rate.svg?style=flat)](https://scrutinizer-ci.com/g/redco/redcode-currency-rate/?branch=master)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/b77d142f-47eb-4e30-81fb-ed56bff5e5bf/mini.png)](https://insight.sensiolabs.com/projects/b77d142f-47eb-4e30-81fb-ed56bff5e5bf)
[![Dependency Status](https://www.versioneye.com/user/projects/5505aebb4a1064727700051d/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5505aebb4a1064727700051d)This library shows an efficient way to work with currencies and currency rates form [Central Bank of Russia](http://www.cbr.ru/eng/), [European Central Bank](https://www.ecb.europa.eu), and [Yahoo Finance](https://finance.yahoo.com/currency-converter/). It contains base classes and interfaces which hide logic about loading currency rates, one of the most useful implementation is [Symfony2 bundle](https://github.com/redco/redcode-currency-rate-bundle).
## Installing
### Composer
You can easily install it with [composer](https://getcomposer.org) by command:
```
composer require redcode/currency-rate
```## Documentation
First of all you need to implement services [ICurrencyRateManager](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Manager/CurrencyRateManager.php), [ICurrencyManager](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Manager/CurrencyManager.php). Then DTO or Entity objects [Currency](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Model/Currency.php) and [CurrencyRate](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Model/CurrencyRate.php).
After that create and configure currencyConverter:
```php
use RedCode\Currency\Rate;// we have initialized $currencyRateManager and $currencyManager
$providerFactory = new Provider\ProviderFactory();
$providerFactory->addProvider(
new Provider\EcbCurrencyRateProvider`(
$currencyRateManager,
$currencyManager
)
);$converter = new CurrencyConverter(
$providerFactory,
$currencyRateManager,
$currencyManager
);$convertedValue = $converter->convert('USD', 'GBP', 100);
```## Tests
To run [tests](https://github.com/redco/redcode-currency-rate/tree/master/tests) use command below:
```shell
./tests/runTests.sh
```## Contribute
Pull requests are welcome. Please see our [CONTRIBUTING](https://github.com/redco/redcode-currency-rate/blob/master/CONTRIBUTING.md) guide.