PHP code example of olakunlevpn / bitcoin_ng

1. Go to this page and download the library: Download olakunlevpn/bitcoin_ng 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/ */

    

olakunlevpn / bitcoin_ng example snippets

 php
use olakunlevpn\BitcoinNairaConverter\Converter;

$convert = new Converter;              // uses Coinbase as default provider
echo $convert->toCurrency('NGN', 0.5); // 2,250,50.00
echo $convert->toCurrency('LTC', 0.5); // 10.12345678
 php
// uses Coinbase as default provider
echo to_currency('NGN', 0.5); // 2,250,50.00
echo to_currency('LTC', 0.5); // 10.12345678
 php
use olakunlevpn\BitcoinNairaConverter\Converter;

$convert = new Converter;         // uses Coinbase as default provider
echo $convert->toBtc(10000, 'NGN'); // 0.0036664
echo $convert->toBtc(20, 'LTC');  // 1.12345678
 php
// uses Coinbase as default provider
echo to_btc(10000, 'NGN'); // 0.0036664
echo to_btc(20, 'LTC');  // 2.12345678
 php
echo to_currency('NGN', 0.5, new CoindeskProvider); // 2,250,50.00
echo to_currency('LTC', 0.5, new BitpayProvider);   // 10.12345678
echo to_btc(10000, 'NGN', new CoindeskProvider);      // 0.00045678
echo to_btc(20, 'LTC', new BitpayProvider);         // 2.12345678
 php
new CoinbaseProvider($httpClient, $psr16CacheImplementation, 5); // cache expires in 5mins, defaults to 60mins