expose / php-shapeshift-io-api

:heavy_dollar_sign: API library for PHP for shapeshift.io service.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Downloads this Month Latest Stable Version Build Status Scrutinizer Code Quality Coverage Status

Installation

composer require achse/php-shapeshift-io-api

Usage

See https://info.shapeshift.io/api for more info about API calls and theirs parameters.

$client = new Client();

$rate = $client->getRate(Coins::BITCOIN, Coins::LITECOIN);
  • All results are arrays and stdClass-es.
  • All errors from api that are caused by invalid requests (bad inputs, etc...) are ApiErrorException-s.
  • Network errors are RequestFailedException.

You can find some examples of usage in tests/ClientTest.phpt.

Money vs. floats

All rate and amount numbers that came from shapeshift.io are represented in string float format, this library keeps it that way.

However, some values like limit and some others came as floats from API. This library converts it to strings for consistency reasons.

Important: NEVER represent money as float!

It's recommended to work with those values with bcmath functions, or implement some Money object as for example is: https://github.com/moneyphp/money.

About

:heavy_dollar_sign: API library for PHP for shapeshift.io service.

License:MIT License


Languages

Language:PHP 100.0%