PHP code example of coinpaprika / coinpaprika-api-php-client

1. Go to this page and download the library: Download coinpaprika/coinpaprika-api-php-client 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/ */

    

coinpaprika / coinpaprika-api-php-client example snippets




// This file is generated by Composer
 = $client->getCoins();

 
 
 // This file is generated by Composer
 my/cache/directory');
 $coins = $client->getTickers();
 

 

 // This file is generated by Composer
 PI_KEY');
 $coins = $client->getCoins();
 

$client = new \Coinpaprika\Client();

$client->getGlobalStats();                    // Global market overview
$client->getCoins();                          // List all coins
$client->getTokenMeta('btc-bitcoin');         // Coin details
$client->getTickers();                        // All tickers
$client->getTickerByCoinId('btc-bitcoin');    // Ticker for coin
$client->getHistoricalTickerByCoinId('btc-bitcoin', '2024-01-01', '24h'); // Historical

$client->getOHLCV('btc-bitcoin', '24h');                         // Latest OHLCV
$client->getTodayOHLCV('btc-bitcoin');                           // Today's OHLCV
$client->getHistoricalOHLCV('btc-bitcoin', '2024-01-01');        // Historical OHLCV

$client->getExchanges();                             // ExchangeDetail[]
$client->getExchangeById('binance');                 // ExchangeDetail
$client->getExchangeMarkets('binance');              // array (raw)

$client->getCoinTwitter('btc-bitcoin');              // array (raw)
$client->getCoinEvents('btc-bitcoin');               // array (raw)
$client->getCoinExchanges('btc-bitcoin');            // array (raw)
$client->getCoinMarkets('btc-bitcoin');              // Market[]
$client->getCoinsMappings();                         // array (raw, Pro)

$client->getPlatforms();                                          // List platforms
$client->getContracts('eth-ethereum');                            // Contracts on Ethereum
$client->getTickerByContract('eth-ethereum', '0xdac1...');        // Ticker by contract
$client->getHistoricalByContract('eth-ethereum', '0xdac1...', ['start' => '2024-01-01']);

$client->search('bitcoin');                          // Search
$client->priceConverter(['base_currency_id' => 'btc-bitcoin', 'quote_currency_id' => 'usd-us-dollars', 'amount' => 1]);
$client->getPersonById('vitalik-buterin');            // array (raw)
$client->getTags();                                   // array (raw)
$client->getTagById('blockchain-service');             // array (raw)
$client->getKeyInfo();                                // KeyInfo (
bash
$ composer 
bash
php examples/smokeTest.php                 # free API
API_KEY=xxx php examples/smokeTest.php     # Pro API
bash
STRESS_ITERATIONS=100 php examples/stressTest.php              # ~10s at default 100ms delay
STRESS_ITERATIONS=500 STRESS_DELAY_MS=50 php examples/stressTest.php
API_KEY=xxx STRESS_ITERATIONS=1000 php examples/stressTest.php # Pro bypasses rate limits