lonnylot/clarityboard-php-sdk

Clarityboard SDK for PHP

v2.0 2018-10-11 08:43 UTC

This package is auto-updated.

Last update: 2024-04-12 03:19:54 UTC


README

This is the Clarityboard SDK for PHP. Please refer to our API Docs for more information.

Requirements

PHP 5.4.0 and later.

Composer

You can install the bindings via Composer. Run the following command:

composer require lonnylot/clarityboard-php-sdk

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Dependencies

The library requires the GuzzleHTTP library.

Getting Started

Before using the SDK endpoints you must set your API key:

\Clarityboard\Client::setApiKey('enter-your-api-key');

Here is an example of making the call synchronously:

$response = \Clarityboard\Dashboard::retrieve(['dashboardId' => 'd290f1ee-6c54-4b01-90e6-d701748f0851']);

Dashboards

List

$response = \Clarityboard\Dashboard::all();

Create

\Clarityboard\Dashboard::create(['name' => 'My New Dashboard']);

Retrieve

$response = \Clarityboard\Dashboard::retrieve(['dashboardId' => 'd290f1ee-6c54-4b01-90e6-d701748f0851']);

Records

Create

\Clarityboard\Dashboard::create([
  'group' => 'Sales',
  'data' => [
    "name" => "Shoe Laces",
    "sale" => 4.99,
    "cost" => 0.99
  ]
]);

Record Group

List

$response = \Clarityboard\RecordGroup::all();

Create/Update

$response = RecordGroup::update(['group' => 'Sales', 'data' => ['Purchase Date' => '2018-09-17T18:24:00']]);

Record

Create

$response = Record::create([
  'group' => 'Sales', 'data' => [
    "name" => "Shoe Laces",
    "sale" => 4.99,
    "cost" => 0.99
  ]
]);