2017 © Pedro Peláez
 

library traackr-api-php

Traackr API PHP Library

image

traackr/traackr-api-php

Traackr API PHP Library

  • Thursday, July 5, 2018
  • by dchancogne
  • Repository
  • 9 Watchers
  • 4 Stars
  • 14,141 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 7 Open issues
  • 40 Versions
  • 7 % Grown

The README.md

Traackr API - PHP Client

Build Status, (*1)

Introduction

This is a PHP implementation of the Traackr API. Documentation for this PHP client is available here: http://traackr.github.io/traackr-api-docs.
For documentation for the Traackr API itself, see: http://api.docs.traackr.com., (*2)

Installation

You can clone this GitHub repository to get the latest version of the code., (*3)

This library is also available via Composer if that's what you use to manage your dependencies. To do this, simply add this to your composer.json file:, (*4)

"minimum-stability": "dev",
"require": {
    "traackr/traackr-api-php": "dev-master"
}

Usage

You will need an API key to make use this library. Contact api@traackr.com to get your key., (*5)

Include the library

You include this library with:, (*6)

require_once('lib/TraackrApi.php');

If you are using Composer the autoload functionality should automatically load the appropriate PHP files (i.e. require 'vendor/autoload.php' will load the library files)., (*7)

Set your API key

To set your API key use:, (*8)

TraackrApi::setApiKey(<your-api-key>);

Some calls require a Customer Key (see documentation). You do not need to pass this key to these calls. You can set (once and for all) your Customer Key with:, (*9)

TraackrApi::setCustomerKey(<your-customer-key);

The client library will take care of including your customer key when needed., (*10)

Note that you can also specify your API key and customer key via environment variables. See the unit tests section., (*11)

API calls

All API calls map to static functions with parameters matching the API call parameters (see documentation). For instance to call /influencers/show you can use:, (*12)

Influencers::show(<influencer-uid>);

Logging

You can tie the client's internal logging into your own application's logging by creating an implementation of the ApiLoggingInterface. Here's an example from CakePHP:, (*13)

class ApiLogger implements Traackr\ApiLoggerInterface
{
   private $parentObj;

   public function __construct($obj) {
      $this->parentObj = $obj;
   }

   public function debug($string) {
      $this->parentObj->log($string, LOG_DEBUG);
   }

   public function error($string) {
      $this->parentObj->log($string, LOG_WARNING);
   }
}

Then, create an instance of your implementation before any API calls are made (e.g. in a constructor):, (*14)

Traackr\TraackrApi::setLogger(
   new ApiLogger($this)
);

Unit Tests

Setup

To run unit tests, you will need to install dependencies required by this project. First, install Composer locally:, (*15)

$ curl -sS https://getcomposer.org/installer | php

Then install dependencies:, (*16)

$ php composer.phar install

Running the tests

The unit tests come with a public API key that you can use to run the unit tests. However the API key provided in the unit tests is only allowed to access read-only end points (i.e. API calls that do not add, modify or delete any data).
To run these read-only tests you can execute:, (*17)

./bin/phpunit --group read-only test

If you try to run the entire test suite with this public API key you will get errors when trying to access functions that change data., (*18)

Running the entire test suite

To run the entire test suite you will need an API key that has full access to the API. You can request one by emailing api-support@traackr.com., (*19)

Before you run unit tests, you need to specify an API key and a Customer key. These 2 values can be specified via ENV variables (so they don't have to be hardcoded in the unit tests)., (*20)

# export TRAACKR_API_KEY=<your-api-key>
# export TRAACKR_CUSTOMER_KEY=<your-customer-key>

Run the entire test suite:, (*21)

./bin/phpunit test

The Versions

05/07 2018

dev-master

9999999-dev https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

05/07 2018

0.29.0

0.29.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

29/06 2018

dev-logging-updates

dev-logging-updates https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

21/05 2018

0.28.0

0.28.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

16/05 2018

dev-audience-search-combined

dev-audience-search-combined https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

18/04 2018

dev-audience-search

dev-audience-search https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

11/01 2018

0.27.0

0.27.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

04/01 2018

dev-BI-6944-instagram

dev-BI-6944-instagram https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

23/10 2017

0.26.0

0.26.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

19/09 2017

dev-php7-tests-support

dev-php7-tests-support https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

14/09 2017

dev-travis-encrypted-key

dev-travis-encrypted-key https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

14/09 2017

0.25.0

0.25.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

14/09 2017

dev-BI-6747-tags-exclusive-array-handling

dev-BI-6747-tags-exclusive-array-handling https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

04/10 2016

0.24.0

0.24.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

19/08 2016

0.23.0

0.23.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

21/07 2016

0.22.0

0.22.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

27/04 2016

0.21.0

0.21.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

13/04 2016

0.20.0

0.20.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

21/03 2016

0.19.0

0.19.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

16/02 2016

0.18.0

0.18.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

17/08 2015

0.17

0.17.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

24/07 2015

0.16

0.16.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.5

 

The Development Requires

api traackr

15/06 2015

dev-Branch_cache

dev-Branch_cache https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

20/03 2015

0.15.1

0.15.1.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

11/02 2015

0.15

0.15.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

02/02 2015

0.14

0.14.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

28/10 2014

0.13

0.13.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

27/08 2014

0.12

0.12.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

15/08 2014

0.11

0.11.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

24/07 2014

0.10

0.10.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

26/06 2014

0.9

0.9.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

12/06 2014

0.8

0.8.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

05/06 2014

0.7

0.7.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

04/06 2014

0.6

0.6.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

06/05 2014

0.5

0.5.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

24/04 2014

0.4

0.4.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

23/04 2014

0.3

0.3.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

15/04 2014

0.2

0.2.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

27/02 2014

0.1

0.1.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr

15/01 2014

0.0

0.0.0.0 https://traackr.com/

Traackr API PHP Library

  Sources   Download

The Requires

  • ext-curl *
  • ext-json *
  • ext-mbstring *
  • php >=5.2

 

The Development Requires

api traackr