Skip to content
Trackops API Client for PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


The Trackops API Client for PHP provides an easy to use set of tools to quickly access your Trackops data from any PHP application.


PHP 5.6+ (compiled with cURL) and Composer are required for installation.

If you don't already have composer installed, you can quickly do so by running this command from your project root directory:

curl -sS | php

Once you have composer, install the trackops/trackops-client-php package from Packagist, like so:

composer require trackops/trackops-client-php

Alternatively, you can manually add trackops/trackops-client-php to your composer.json, like so:

    "require": {
        "trackops/trackops-client-php": "~0.2"

Once the package is successfully installed with composer, install the dependencies like so:

composer install

Getting Started

It only takes a few lines of code to get a working example up and running:

Basic Example of Usage

Use the get() method to retrieve a set of records

// require the composer autoloader
require 'vendor/autoload.php';

use Trackops\Api\Client;

$api = new Client('subdomain', 'username', 'apitoken');
$records = $api->createRequest()->get('cases')->toArray();

Using Query Parameters

We're passing a $params variable with an array of query parameters to this request.

require 'vendor/autoload.php';

use Trackops\Api\Client;

$api = new Client('subdomain', 'username', 'apitoken');
$params = ['from' => '2016-01-01', 'to' => '2016-01-31', 'dir' => 'asc', 'per_page' => 1, 'page' => 1];
$records = $api->createRequest()->get('cases', $params)->toArray();

Visit the Trackops Developer API Reference for a full list of endpoints and query parameters.

Counting Results

Use the count() method to quickly get the total record_count and page_count of your query.

require 'vendor/autoload.php';

use Trackops\Api\Client;

$api = new Client('subdomain', 'username', 'apitoken');
$params = ['from' => '2016-01-01', 'to' => '2016-01-31'];
$records = $api->createRequest()->count('cases', $params)->toArray();

Tip: For more advanced implementations, take a look at the examples directory in the project source code.

You can’t perform that action at this time.