PHPackages                             dominionenterprises/tol-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dominionenterprises/tol-api

Abandoned → [traderinteractive/tol-api](/?search=traderinteractive%2Ftol-api)Library[API Development](/categories/api)

dominionenterprises/tol-api
===========================

PHP client library for REST APIs

v5.1.0(1y ago)568.0k15MITPHPPHP ^7.3 || ^8.0CI passing

Since Jul 7Pushed 5mo ago66 watchersCompare

[ Source](https://github.com/traderinteractive/tol-api-php)[ Packagist](https://packagist.org/packages/dominionenterprises/tol-api)[ RSS](/packages/dominionenterprises-tol-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (41)Used By (0)

tol-api-php
===========

[](#tol-api-php)

[![Build Status](https://camo.githubusercontent.com/81f56b28582b8ac5ad8977a12c1c76f21039b4e04dac3e3523229150b3ab1ca6/68747470733a2f2f7472617669732d63692e6f72672f747261646572696e7465726163746976652f746f6c2d6170692d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/traderinteractive/tol-api-php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4e72eb8f2c54c3ff74ffc698fa2d19ce68281fc40d3059536d3ba60c6bb6d9d0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747261646572696e7465726163746976652f746f6c2d6170692d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/traderinteractive/tol-api-php/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/274cc33ff9332a400cbd210e99433220dd145aa02360cc3f6c3332e54497c93b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f747261646572696e7465726163746976652f746f6c2d6170692d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/traderinteractive/tol-api-php?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/a256a69dde51f514c5f09327bc9d7f80706ae89491c08735174e3d9b5062ec48/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f746f6c2d6170692f762f737461626c65)](https://packagist.org/packages/traderinteractive/tol-api)[![Latest Unstable Version](https://camo.githubusercontent.com/392d48f7cd7ccb1a9c621b6f84875468b9811ae35d931790bbb94d2a0962c861/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f746f6c2d6170692f762f756e737461626c65)](https://packagist.org/packages/traderinteractive/tol-api)[![License](https://camo.githubusercontent.com/27ba75d9df5f7bdd0c6b8da4f8d8574c23ccf31a54ec1c7fd353ee0158b7d8fb/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f746f6c2d6170692f6c6963656e7365)](https://packagist.org/packages/traderinteractive/tol-api)

[![Total Downloads](https://camo.githubusercontent.com/15be42b76fed9b9a4e0bd645a33050c050791f5a2959e23c7c29e0281db70d16/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f746f6c2d6170692f646f776e6c6f616473)](https://packagist.org/packages/traderinteractive/tol-api)[![Daily Downloads](https://camo.githubusercontent.com/2c1c4652d338b83806de06657d4716cfbeae1c39eb244cb2ba3579e4530a1729/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f746f6c2d6170692f642f6461696c79)](https://packagist.org/packages/traderinteractive/tol-api)[![Monthly Downloads](https://camo.githubusercontent.com/4509105990b697d72bc2e11764a0964f9c4cfbf5b635157ec7d8586394aa6b29/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f746f6c2d6170692f642f6d6f6e74686c79)](https://packagist.org/packages/traderinteractive/tol-api)

This is a PHP client for [REST](http://en.wikipedia.org/wiki/Representational_state_transfer) APIs like the TraderOnline APIs.

Requirements
------------

[](#requirements)

This api client requires PHP 7.3 or newer and uses composer to install further PHP dependencies. See the [composer specification](composer.json) for more details.

When contributing, access to a working mongo database for testing is needed. See the [Contribution Guidelines](.github/CONTRIBUTING.md) for more details.

Installation
------------

[](#installation)

tol-api-php can be installed for use in your project using [composer](http://getcomposer.org).

The recommended way of using this library in your project is to add a `composer.json` file to your project. The following contents would add tol-api-php as a dependency:

```
composer require traderinteractive/tol-api
```

Basic Usage
-----------

[](#basic-usage)

The basic guzzle client, without caching or automated pagination handling is mostly easy to work with.

To instantiate a client, you need the guzzle adapter, client id, client secret, and API url. This client should work with apis like the TOL APIs.

```
use TraderInteractive\Api;
$apiAdapter = new Api\GuzzleAdapter();
$auth = Api\Authentication::createClientCredentials(
    'clientId',
    'clientSecret'
)
$apiClient = new Api\Client(
    $apiAdapter,
    $auth,
    'https://baseApiUrl/v1'
);
```

Then you can make index requests like below, although it is recommended to take a look at the [Collection](#collection) section below so that you can take advantage of automatic pagination handling. Here's an example of how to fetch a single page of items.

```
