PHP code example of codenix-sv / coingecko-api

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

    

codenix-sv / coingecko-api example snippets


use Codenixsv\CoinGeckoApi\CoinGeckoClient;

$client = new CoinGeckoClient();
$data = $client->ping();

use Codenixsv\CoinGeckoApi\CoinGeckoClient;

$client = new CoinGeckoClient();
$data = $client->derivatives()->getExchanges();
$response = $client->getLastResponse();
$headers = $response->getHeaders();

$data = $client->ping();

$data = $client->simple()->getPrice('0x,bitcoin', 'usd,rub');

$data = $client->simple()->getTokenPrice('ethereum','0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd,rub');

$data = $client->simple()->getSupportedVsCurrencies();

$data = $client->coins()->getList();

$data = $result = $client->coins()->getMarkets('usd');

$result = $client->coins()->getCoin('bitcoin', ['tickers' => 'false', 'market_data' => 'false']);

$result = $client->coins()->getTickers('bitcoin');

$result = $client->coins()->getHistory('bitcoin', '30-12-2017');

$result = $client->coins()->getMarketChart('bitcoin', 'usd', 'max');

$result = $client->coins()->getMarketChartRange('bitcoin', 'usd', '1392577232', '1422577232');

$result = $client->coins()->getStatusUpdates('0x');

$data = $client->contract()->getContract('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498');

$result = $client->contract()->getMarketChart('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '1');

$result = $result = $client->contract()->getMarketChartRange('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '11392577232', ' 1422577232');

$data = $client->exchanges()->getExchanges();

$data = $client->exchanges()->getList();

$data = $client->exchanges()->getExchange('binance');

$data = $client->exchanges()->getTickers('binance', ['coin_ids' => '0x,bitcoin']);

$data = $client->exchanges()->getStatusUpdates('binance');

$data = $client->exchanges()->getVolumeChart('binance', '1');

$data = $client->finance()->getPlatforms();

$data = $client->finance()->getProducts();

$data = $client->indexes()->getIndexes();

$data = $client->indexes()->getIndex('BAT');

$data = $client->indexes()->getList();

$data = $client->derivatives()->getDerivatives();

$data = $client->derivatives()->getExchanges();

$data = $client->derivatives()->getExchange('binance_futures');

$data = $client->derivatives()->getExchangeList();

$data = $client->statusUpdates()->getStatusUpdates();

$data = $client->events()->getEvents();

$data = $client->events()->getCountries();

$data = $client->events()->getTypes();

$data = $client->exchangeRates()->getExchangeRates();

$data = $client->globals()->getGlobal();