PHP code example of musheabdulhakim / coingecko
1. Go to this page and download the library: Download musheabdulhakim/coingecko 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/ */
musheabdulhakim / coingecko example snippets
use MusheAbdulHakim\CoinGecko\CoinGecko;
$coingecko = new CoinGecko();
$ping = $coingecko->ping();
'version' => 'v3',
'base_url' => 'https://api.coingecko.com/api/',
'api_key' => '',
$ping = $coingecko->ping();
$price = $coingecko->simple()->getPrice('0x,bitcoin', 'usd,rub');
$token_price = $coingecko->simple()->getTokenPrice('ethereum','0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd,rub');
$data = $coingecko->simple()->getSupportedVsCurrencies();
$coins = $coingecko->coins()->getList();
$result = $coingecko->coins()->getMarkets('usd');
$data = $coingecko->coins()->getCoin('bitcoin', ['tickers' => 'false', 'market_data' => 'false']);
$tickets = $coingecko->coins()->getTickers('bitcoin');
$result = $coingecko->coins()->getHistory('bitcoin', '30-12-2017');
$result = $coingecko->coins()->getMarketChart('bitcoin', 'usd', 'max');
$result = $coingecko->coins()->getMarketChartRange('bitcoin', 'usd', '1392577232', '1422577232');
$result = $coingecko->coins()->getStatusUpdates('0x');
$data = $coingecko->contract()->getContract('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498');
$result = $coingecko->contract()->getMarketChart('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '1');
$result = $coingecko->contract()->getMarketChartRange('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '11392577232', ' 1422577232');
$data = $coingecko->assetPlatforms()->getList();
$data = $coingecko->categories()->getList();
$data = $coingecko->categories()->getListWithMarketData();
$exchanges = $coingecko->exchanges()->getExchanges();
$exchange_list = $coingecko->exchanges()->getList();
$exchange = $coingecko->exchanges()->getExchange('binance');
$data = $coingecko->exchanges()->getTickers('binance', ['coin_ids' => '0x,bitcoin']);
$data = $coingecko->exchanges()->getStatusUpdates('binance');
$data = $coingecko->exchanges()->getVolumeChart('binance', '1');
$data = $coingecko->indexes()->getIndexes();
$data = $coingecko->indexes()->getIndex('BAT');
$data = $coingecko->indexes()->getList();
$data = $client->derivatives()->getDerivatives();
$data = $coingecko->derivatives()->getExchanges();
$data = $coingecko->derivatives()->getExchange('binance_futures');
$data = $coingecko->derivatives()->getExchangeList();
$data = $coingecko->exchangeRates()->getExchangeRates();
$data = $coingecko->search()->query('ethereum');
$data = $coingecko->trending()->getList();
$data = $coingecko->globals()->getGlobal();
$data = $coingecko->globals()->getGlobalDecentralizedFinanceDefi();
$data = $coingecko->companies()->getPublicTreasury('ethereum');