2017 © Pedro Peláez
 

library coingecko-api

Coingecko REST API php client

image

madmis/coingecko-api

Coingecko REST API php client

  • Thursday, August 31, 2017
  • by madmis
  • Repository
  • 3 Watchers
  • 4 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Coingecko REST API PHP Client

SensioLabsInsight ![Build Status][testing-image] [Coverage Status][coverage-link] Latest Stable Version Total Downloads License, (*1)

This API client will help you interact with Coingecko data., (*2)

License

MIT License, (*3)

Contributing

To create new endpoint - create issue or create pull request, (*4)

Install

composer require madmis/coingecko-api 1.0.*

Usage

$api = new CoingeckoApi();
$timestamp = $api->shared()->priceCharts(Api::BASE_ETH, Api::QUOTE_USD, Api::PERIOD_24HOURS, true));

Mapping

Each endpoint response can be received as array or as object., (*5)

To use mapping response to object set parameter $mapping to true., (*6)

$issue = $api->shared()->priceCharts(Api::BASE_ETH, Api::QUOTE_USD, Api::PERIOD_24HOURS, true));

// Result
[
    {
    class madmis\CoingeckoApi\Model\Price {
        protected $price => 379.62131925945
        protected $date => DateTime
      }

    },
    ...
] 

Error handling

Each client request errors wrapped to custom exception madmis\ExchangeApi\Exception\ClientException, (*7)

class madmis\ExchangeApi\Exception\ClientException {
  private $request => class GuzzleHttp\Psr7\Request
  private $response => NULL
  protected $message => "cURL error 7: Failed to connect to 127.0.0.1 port 8080: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"
  ...
}

ClientException contains original request object and response object if response available, (*8)

class madmis\ExchangeApi\Exception\ClientException {
  private $request => class GuzzleHttp\Psr7\Request 
  private $response => class GuzzleHttp\Psr7\Response {
    private $reasonPhrase => "Unauthorized"
    private $statusCode => 401
    ...
  }
  protected $message => "Client error: 401"
  ...  
}

Running the tests

To run the tests, you'll need to install phpunit. Easiest way to do this is through composer., (*9)

composer install

Running Unit tests

php vendor/bin/phpunit -c phpunit.xml.dist

The Versions

31/08 2017

dev-master

9999999-dev

Coingecko REST API php client

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest coingecko

31/08 2017

1.0.0

1.0.0.0

Coingecko REST API php client

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest coingecko