CoinGeckApi is a PHP & Laravel Package, (Designed to help working with coingecko api easier and faster).
- Git
- Composer
- php >= 7.4
$ composer require musheabdulhakim/coingecko
use MusheAbdulHakim\CoinGecko\CoinGecko;
$coingecko = new CoinGecko();
$ping = $coingecko->ping();
Update api version, base url and api key
'version' => 'v3',
'base_url' => 'https://api.coingecko.com/api/',
'api_key' => '',
Check API server status
$ping = $coingecko->ping();
Get the current price of any cryptocurrencies in any other supported currencies that you need.
$price = $coingecko->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.
$token_price = $coingecko->simple()->getTokenPrice('ethereum','0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd,rub');
Get list of supported_vs_currencies.
$data = $coingecko->simple()->getSupportedVsCurrencies();
List all supported coins id, name and symbol (no pagination required)
$coins = $coingecko->coins()->getList();
List all supported coins price, market cap, volume, and market related data
$result = $coingecko->coins()->getMarkets('usd');
Get current data (name, price, market, ... including exchange tickers) for a coin
$data = $coingecko->coins()->getCoin('bitcoin', ['tickers' => 'false', 'market_data' => 'false']);
Get coin tickers (paginated to 100 items)
$tickets = $coingecko->coins()->getTickers('bitcoin');
Get historical data (name, price, market, stats) at a given date for a coin
$result = $coingecko->coins()->getHistory('bitcoin', '30-12-2017');
Get historical market data include price, market cap, and 24h volume (granularity auto)
$result = $coingecko->coins()->getMarketChart('bitcoin', 'usd', 'max');
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto)
$result = $coingecko->coins()->getMarketChartRange('bitcoin', 'usd', '1392577232', '1422577232');
Get status updates for a given coin
$result = $coingecko->coins()->getStatusUpdates('0x');
Get coin info from contract address
$data = $coingecko->contract()->getContract('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498');
Get historical market data include price, market cap, and 24h volume (granularity auto) from a contract address
$result = $coingecko->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 = $coingecko->contract()->getMarketChartRange('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '11392577232', ' 1422577232');
List all asset platforms
$data = $coingecko->assetPlatforms()->getList();
List all categories
$data = $coingecko->categories()->getList();
List all categories with market data
$data = $coingecko->categories()->getListWithMarketData();
List all exchanges
$exchanges = $coingecko->exchanges()->getExchanges();
List all supported markets id and name (no pagination required)
$exchange_list = $coingecko->exchanges()->getList();
Get exchange volume in BTC and top 100 tickers only
$exchange = $coingecko->exchanges()->getExchange('binance');
Get exchange tickers (paginated)
$data = $coingecko->exchanges()->getTickers('binance', ['coin_ids' => '0x,bitcoin']);
Get status updates for a given exchange
$data = $coingecko->exchanges()->getStatusUpdates('binance');
Get volume_chart data for a given exchange
$data = $coingecko->exchanges()->getVolumeChart('binance', '1');
List all market indexes
$data = $coingecko->indexes()->getIndexes();
Get market index by id
$data = $coingecko->indexes()->getIndex('BAT');
List market indexes id and name
$data = $coingecko->indexes()->getList();
List all derivative tickers
$data = $client->derivatives()->getDerivatives();
List all derivative exchanges
$data = $coingecko->derivatives()->getExchanges();
Show derivative exchange data
$data = $coingecko->derivatives()->getExchange('binance_futures');
List all derivative exchanges name and identifier
$data = $coingecko->derivatives()->getExchangeList();
Get BTC-to-Currency exchange rates
$data = $coingecko->exchangeRates()->getExchangeRates();
Search for coins, categories and markets listed on CoinGecko ordered by largest Market Cap first
$data = $coingecko->search()->query('ethereum');
List trending coins by most popular first
$data = $coingecko->trending()->getList();
Get cryptocurrency global data
$data = $coingecko->globals()->getGlobal();
Get Top 100 Cryptocurrency Global Decentralized Finance(defi) data
$data = $coingecko->globals()->getGlobalDecentralizedFinanceDefi();
Get cryptocurrency global data
$data = $coingecko->companies()->getPublicTreasury('ethereum');
To run the tests, run the following command from the project folder.
$ ./vendor/bin/phpunit
musheabdulhakim/coingecko
is released under the MIT License. See the bundled LICENSE for details.
Report all your issues Here
All your pull requests are welcome :).