Skip to content

coinpaprika/coinpaprika-api-php-client

Repository files navigation

Coinpaprika API PHP Client

Coins Bitcoin Price USD

Logo

Latest Stable Version Build Status Software License Quality Score Code Coverage Total Downloads

Usage

This library provides convenient way to use coinpaprika.com API in PHP.

Coinpaprika delivers full market data to the world of crypto: coin prices, volumes, market caps, ATHs, return rates and more.

Requirements

  • PHP >= 7.1
  • (optional) PHPUnit to run tests.

Install

Via Composer:

$ composer require coinpaprika/coinpaprika-api-php-client

Getting started

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

$client = new \Coinpaprika\Client();
$coins = $client->getCoins();

From $client object, you can access all the endpoints.

Cache usage

For deserialization process it is advised to initiate the $client with $cacheDir argument.

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

$client = new \Coinpaprika\Client('my/cache/directory');
$coins = $client->getTickers();

Paid API

To use paid version set the api key

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

$client = new \Coinpaprika\Client('my/cache/directory');
$client->setApiKey('PROVIDED_API_KEY');
$coins = $client->getCoins();

Examples

Check out the ./examples directory.

License

CoinpaprikaAPI is available under the MIT license. See the LICENSE file for more info.