PHP code example of jimmerioles / bitcoin-currency-converter-php
1. Go to this page and download the library: Download jimmerioles/bitcoin-currency-converter-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jimmerioles / bitcoin-currency-converter-php example snippets
bash
$ composer
php
use Jimmerioles\BitcoinCurrencyConverter\Converter;
$convert = new Converter; // uses Coinbase as default provider
echo $convert->toCurrency('USD', 0.5); // 2000.00
echo $convert->toCurrency('LTC', 0.5); // 10.12345678
php
// uses Coinbase as default provider
echo to_currency('USD', 0.5); // 2000.00
echo to_currency('LTC', 0.5); // 10.12345678
php
use Jimmerioles\BitcoinCurrencyConverter\Converter;
$convert = new Converter; // uses Coinbase as default provider
echo $convert->toBtc(100, 'USD'); // 0.12345678
echo $convert->toBtc(20, 'LTC'); // 1.12345678
php
// uses Coinbase as default provider
echo to_btc(100, 'USD'); // 0.12345678
echo to_btc(20, 'LTC'); // 2.12345678
php
echo to_currency('USD', 0.5, new CoindeskProvider); // 2000.00
echo to_currency('LTC', 0.5, new BitpayProvider); // 10.12345678
echo to_btc(100, 'USD', new CoindeskProvider); // 0.12345678
echo to_btc(20, 'LTC', new BitpayProvider); // 2.12345678
php
new CoinbaseProvider($httpClient, $psr16CacheImplementation, 5); // cache expires in 5mins, defaults to 60mins