PHP code example of paneedesign / coinmarketcap-bundle

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

    

paneedesign / coinmarketcap-bundle example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...

            new PaneeDesign\CoinMarketCapBundle\PedCoinMarketCapBundle(),
        ];

        // ...
    }

    // ...
}

$cmc = $this->get('ped_coin_market_cap.api');

$response = $cmc->cryptocurrency()->map(['limit' => 3]);

$response = $cmc->cryptocurrency()->info(['id' => 1]);

$response = $cmc->cryptocurrency()->listingsLatest(['limit' => 3, 'convert' => 'EUR']);

$response = $cmc->cryptocurrency()->quotesLatest(['id' => 1, 'convert' => 'EUR']);

$response = $cmc->globalMetrics()->quotesLatest(['convert' => 'EUR']);
json
{
  "status": {
    "timestamp": "2018-09-18T14:02:00.100Z",
    "error_code": 0,
    "error_message": null,
    "elapsed": 4,
    "credit_count": 1
  },
  "data": {
    "active_cryptocurrencies": 1969,
    "active_market_pairs": 14052,
    "active_exchanges": 219,
    "eth_dominance": 10.7,
    "btc_dominance": 55.3,
    "quote": {
      "EUR": {
        "total_market_cap": 169987221659,
        "total_volume_24h": 11805377386,
        "last_updated": "2018-09-18T14:00:00.000Z"
      }
    },
    "last_updated": "2018-09-18T13:52:00.000Z"
  }
}