PHP code example of kristapsk / php-coindesk-api

1. Go to this page and download the library: Download kristapsk/php-coindesk-api 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/ */

    

kristapsk / php-coindesk-api example snippets


use kristapsk\CoinDesk\BPI;

// returns float or null on failure
var_dump(BPI::currentPrice('EUR'));

use kristapsk\CoinDesk\BPI;

// returns array with Y-m-d format date string as key and float price as value
// or null on failure
var_dump(BPI::historical(strtotime('2021-03-01'), strtotime('2021-03-16'), 'EUR'));

composer