PHP code example of vittominacori / coinmarketcap-php
1. Go to this page and download the library: Download vittominacori/coinmarketcap-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/ */
vittominacori / coinmarketcap-php example snippets
$cmc = new CoinMarketCap\Api('yourApiClient');
$response = $cmc->cryptocurrency()->map(['limit' => 3]);
$response = $cmc->cryptocurrency()->info(['symbol' => 'BTC']);
$response = $cmc->cryptocurrency()->listingsLatest(['limit' => 3, 'convert' => 'EUR']);
$response = $cmc->cryptocurrency()->quotesLatest(['id' => 1, 'convert' => 'EUR']);
$response = $cmc->globalMetrics()->quotesLatest(['convert' => 'EUR']);
$response = $cmc->tools()->priceConversion(['amount' => 1, 'symbol' => 'BTC']);
$response = $cmc->partners()->flipsideFCASListingLatest(['limit' => 3]);
$response = $cmc->partners()->flipsideFCASQuotesLatest(['symbol' => 'BTC']);
composer
json
{
"status": {
"timestamp": "2019-12-08T16:50:02.600Z",
"error_code": 0,
"error_message": null,
"elapsed": 17,
"credit_count": 1,
"notice": null
},
"data": {
"1": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"slug": "bitcoin",
"num_market_pairs": 7761,
"date_added": "2013-04-28T00:00:00.000Z",
"tags": [
"mineable"
],
"max_supply": 21000000,
"circulating_supply": 18090537,
"total_supply": 18090537,
"platform": null,
"cmc_rank": 1,
"last_updated": "2019-12-08T16:49:31.000Z",
"quote": {
"EUR": {
"price": 6846.048756240301,
"volume_24h": 13780116049.701561,
"percent_change_1h": -0.573398,
"percent_change_24h": 0.0698591,
"percent_change_7d": 2.34665175,
"market_cap": 123848698328.56917,
"last_updated": "2019-12-08T16:49:01.000Z"
}
}
}
}
}
json
{
"status": {
"timestamp": "2019-12-08T16:52:15.834Z",
"error_code": 0,
"error_message": null,
"elapsed": 14,
"credit_count": 1,
"notice": null
},
"data": {
"active_cryptocurrencies": 3202,
"total_cryptocurrencies": 4904,
"active_market_pairs": 20818,
"active_exchanges": 614,
"total_exchanges": 844,
"eth_dominance": 8.01647,
"btc_dominance": 66.7296,
"quote": {
"EUR": {
"total_market_cap": 185597924909.75104,
"total_volume_24h": 45763346301.02166,
"total_volume_24h_reported": 50288735661.71643,
"altcoin_volume_24h": 31983230251.320095,
"altcoin_volume_24h_reported": 35040992890.64553,
"altcoin_market_cap": 61749226581.18235,
"last_updated": "2019-12-08T16:51:01.000Z"
}
},
"last_updated": "2019-12-08T16:50:00.000Z"
}
}