edbizarro/cmcphp

PHP wrapper for CoinMarketCap API.

v2.0.1 2019-04-22 23:35 UTC

README

68747470733a2f2f73322e636f696e6d61726b65746361702e636f6d2f67656e6572617465642f737061726b6c696e65732f7765622f37642f7573642f313536372e706e67

StyleCI 68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35323561393039356531336135396331313435652f6d61696e7461696e6162696c697479 68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246656462697a6172726f253246636d637068702e7376673f747970653d736869656c64 68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3130373665633535653565373466613461633736393337316430666261653738 Latest Stable Version License 68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246656462697a6172726f253246636d637068702e7376673f747970653d736d616c6c

CoinMarketCap API

This package works with V1 free api, to work with Pro version some work are needed (PR are welcome)

Here are a few examples on how you can use the package:

$market = new Edbizarro\Cmc\Market;

//get ticker (default limit is set to 10)
$market->ticker();

//get ticker with different limit
$market->ticker(100);

//get ticker for a specific coin
$market->ticker('nano');

//get ticker with all options (limit 100, start 0 and convert to BRL)
$market->ticker(100, 0, 'BRL');

Response example

{
    "id": "bitcoin",
    "name": "Bitcoin",
    "symbol": "BTC",
    "rank": "1",
    "price_usd": "9087.87",
    "price_btc": "1.0",
    "24h_volume_usd": "7117920000.0",
    "market_cap_usd": "153074828154",
    "available_supply": "16843862.0",
    "total_supply": "16843862.0",
    "max_supply": "21000000.0",
    "percent_change_1h": "-0.86",
    "percent_change_24h": "4.39",
    "percent_change_7d": "-21.76",
    "last_updated": "1517707168",
    "price_brl": "29247.492021",
    "24h_volume_brl": "22907601936.0",
    "market_cap_brl": "492640719448"
},
{
    "id": "ethereum",
    "name": "Ethereum",
    "symbol": "ETH",
    "rank": "2",
    "price_usd": "952.455",
    "price_btc": "0.104047",
    "24h_volume_usd": "3178180000.0",
    "market_cap_usd": "92765037932.0",
    "available_supply": "97395717.0",
    "total_supply": "97395717.0",
    "max_supply": null,
    "percent_change_1h": "-1.23",
    "percent_change_24h": "5.17",
    "percent_change_7d": "-15.64",
    "last_updated": "1517707154",
    "price_brl": "3065.2859265",
    "24h_volume_brl": "10228336694.0",
    "market_cap_brl": "298545721577"
}

Installation

You can install the package via composer:

composer require edbizarro/cmcphp

forthebadge