Stars: 123
Forks: 60
Pull Requests: 8
Issues: 13
Watchers: 7
Last Updated: 2023-01-14 13:58:47
CoinGecko PHP API client for coingecko.com (V3)
License: MIT License
Languages: PHP
A simple API client, written with PHP for coingecko.com.
CoinGecko provides a fundamental analysis of the crypto market. In addition to tracking price, volume and market capitalization, CoinGecko tracks community growth, open-source code development, major events and on-chain metrics.
For additional information about API visit coingecko.com/api
CoinGecko API Terms of Service
The preferred way to install this extension is through composer.
Either run
$ composer require codenix-sv/coingecko-api
or add
"codenix-sv/coingecko-api": "^1.0"
use Codenixsv\CoinGeckoApi\CoinGeckoClient;
$client = new CoinGeckoClient();
$data = $client->ping();
You can get last response (ResponseInterface::class
) uses getLastResponse
method:
use Codenixsv\CoinGeckoApi\CoinGeckoClient;
$client = new CoinGeckoClient();
$data = $client->derivatives()->getExchanges();
$response = $client->getLastResponse();
$headers = $response->getHeaders();
Check API server status
$data = $client->ping();
Get the current price of any cryptocurrencies in any other supported currencies that you need.
$data = $client->simple()->getPrice('0x,bitcoin', 'usd,rub');
Get current price of tokens (using contract addresses) for a given platform in any other currency that you need.
$data = $client->simple()->getTokenPrice('ethereum','0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd,rub');
Get list of supported_vs_currencies.
$data = $client->simple()->getSupportedVsCurrencies();
List all supported coins id, name and symbol (no pagination required)
$data = $client->coins()->getList();
List all supported coins price, market cap, volume, and market related data
$data = $result = $client->coins()->getMarkets('usd');
Get current data (name, price, market, ... including exchange tickers) for a coin
$result = $client->coins()->getCoin('bitcoin', ['tickers' => 'false', 'market_data' => 'false']);
Get coin tickers (paginated to 100 items)
$result = $client->coins()->getTickers('bitcoin');
Get historical data (name, price, market, stats) at a given date for a coin
$result = $client->coins()->getHistory('bitcoin', '30-12-2017');
Get historical market data include price, market cap, and 24h volume (granularity auto)
$result = $client->coins()->getMarketChart('bitcoin', 'usd', 'max');
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto)
$result = $client->coins()->getMarketChartRange('bitcoin', 'usd', '1392577232', '1422577232');
Get status updates for a given coin
$result = $client->coins()->getStatusUpdates('0x');
Get coin info from contract address
$data = $client->contract()->getContract('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498');
Get historical market data include price, market cap, and 24h volume (granularity auto) from a contract address
$result = $client->contract()->getMarketChart('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '1');
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) from a contract address
$result = $result = $client->contract()->getMarketChartRange('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '11392577232', ' 1422577232');
List all exchanges
$data = $client->exchanges()->getExchanges();
List all supported markets id and name (no pagination required)
$data = $client->exchanges()->getList();
Get exchange volume in BTC and top 100 tickers only
$data = $client->exchanges()->getExchange('binance');
Get exchange tickers (paginated)
$data = $client->exchanges()->getTickers('binance', ['coin_ids' => '0x,bitcoin']);
Get status updates for a given exchange (beta)
$data = $client->exchanges()->getStatusUpdates('binance');
Get volume_chart data for a given exchange (beta)
$data = $client->exchanges()->getVolumeChart('binance', '1');
List all finance platforms
$data = $client->finance()->getPlatforms();
List all finance products
$data = $client->finance()->getProducts();
List all market indexes
$data = $client->indexes()->getIndexes();
Get market index by id
$data = $client->indexes()->getIndex('BAT');
List market indexes id and name
$data = $client->indexes()->getList();
List all derivative tickers
$data = $client->derivatives()->getDerivatives();
List all derivative exchanges
$data = $client->derivatives()->getExchanges();
Show derivative exchange data
$data = $client->derivatives()->getExchange('binance_futures');
List all derivative exchanges name and identifier
$data = $client->derivatives()->getExchangeList();
List all status_updates with data (description, category, created_at, user, user_title and pin)
$data = $client->statusUpdates()->getStatusUpdates();
Get events, paginated by 100
$data = $client->events()->getEvents();
Get list of event countries
$data = $client->events()->getCountries();
Get list of events types
$data = $client->events()->getTypes();
Get BTC-to-Currency exchange rates
$data = $client->exchangeRates()->getExchangeRates();
Get cryptocurrency global data
$data = $client->globals()->getGlobal();
codenix-sv/coingecko-api
is released under the MIT License. See the bundled LICENSE for details.