composer require achse/php-shapeshift-io-api
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
.
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.