2017 © Pedro Peláez
 

library dolar-blue

Package to fetch latest USD conversion rate on Argentina's black market

image

fedeisas/dolar-blue

Package to fetch latest USD conversion rate on Argentina's black market

  • Thursday, May 29, 2014
  • by fedeisas
  • Repository
  • 1 Watchers
  • 1 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Dolar Blue PHP

Travis Badge Coverage Status Latest Stable Version Latest Unstable Version Total Downloads License, (*1)

Why?

Because Argentina has a black market for currency exchange. And this makes it easy to retrieve the current USD conversion rate from different sources. And also because I needed something small to talk about Package Development and testing on this meetup., (*2)

Requirements

  • PHP >= 5.4

Installation

Begin by installing this package through Composer. Edit your project's composer.json file to require `fedeisas/dolar-blue., (*3)

{
  "require": {
        ...
        "fedeisas/dolar-blue": "1.*"
        ...
    },
    "minimum-stability" : "dev"
}

Next, update Composer from the Terminal:, (*4)

$ composer update

Once this operation completes, the final step is to add the service provider. Open app/config/app.php, and add a new item to the providers array., (*5)

'providers' => array(
    ...
    'Fedeisas\LaravelDolarBlue\LaravelDolarBlueServiceProvider',
)

Optionally you can also add the Facade to the aliases array on app/config/app.php:, (*6)

'aliases' => array(
    ...
    'DolarBlue' => 'Fedeisas\LaravelDolarBlue\Facade\LaravelDolarBlue',
)

Providers

Usage

use Fedeisas\DolarBlue\DolarBlue;
use GuzzleHttp\Client;

$service = new DolarBlue(new Client);
$result = $service->get('DolarBlue'); // or $service->DolarBlue();
// returns
// array(
//   'buy' => '10.15',
//   'sell' => '10.55',
//   'timestamp' => 1399080004
// )

Or you can use magic methods:, (*7)

$result = $service->LaNacion();
$result = $service->DolarBlue();
$result = $service->BlueLytics();

Contributing

$ composer install --dev
$ ./vendor/bin/phpunit

In addition to a full test suite, there is Travis integration., (*8)

Found a bug?

Please, let me know! Send a pull request or a patch. Questions? Ask! I will respond to all filed issues., (*9)

Inspiration

I needed an idea for a small library, and I borrowed it from a friend who has done something similar for NodeJS. You should check it out: https://github.com/matiu/dolar-blue, (*10)

License

This package is open-sourced software licensed under the MIT license, (*11)

The Versions