PHP code example of mostafasoufi / cryptoprice

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

    

mostafasoufi / cryptoprice example snippets



CryptoPrice\CryptoPrice;
use CryptoPrice\Service\Binance;
use CryptoPrice\Service\CoinMarketCap;

// Initial CryptoPrice class.
$Binance = new CryptoPrice(new Binance());
$Binance->setCrypto('Bitcoin');

$CoinMarketCap = new CryptoPrice(new CoinMarketCap());
$CoinMarketCap->setCrypto('Bitcoin');

$Binance->getSymbol();
$CoinMarketCap->getSymbol();

$Binance->getUSDPrice();
$CoinMarketCap->getUSDPrice();

$Binance->getUSDPriceBYSymbol('BTCTUSD');
$CoinMarketCap->getUSDPriceBYSymbol('BTC');