oliveris/sdk-mycrystalhub

A PHP-SDK for MyCrystalHub API

v1.0.9 2018-07-30 13:45 UTC

This package is auto-updated.

Last update: 2024-09-18 02:21:38 UTC


README

PHP-SDK for MyCrystalHub API

Used to access your companies data.

Usage

Pull in the composer package by running the command below:

composer require oliveris/sdk-mycrystalhub

Import the Crystal namespace into the class (autoloading)

use Crystal\Crystal;

Examples

Setting your API environment

Below shows an example if you need to access a different environments API, for example, staging. By default it is set on production.

$crystal = new Crystal();
$crystal->setApiEnvironment('staging');

Retrieving all of the companies clients

Below is a basic example of how to make a request to retrieve your companies clients.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveAllClients();

Retrieving all of the companies quotes

Below is a basic example of how to make a request to retrieve your companies quotes.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveAllQuotes();

Retrieving all of the companies jobs

Below is a basic example of how to make a request to retrieve your companies jobs.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveAllJobs();

Retrieving all of the companies invoices

Below is a basic example of how to make a request to retrieve your companies invoices.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveAllInvoices();

Retrieving all of the companies employees

Below is a basic example of how to make a request to retrieve your companies employees.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveAllEmployees();

Retrieving a single client

Below is a basic example of how to make a request to retrieve a single client.

The $client_id variable should be an integer type.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveClient($client_id);

Retrieving a single quote

Below is a basic example of how to make a request to retrieve a single quote.

The $quote_ref variable should be a string type, eg 'QU1/1'.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveQuote($quote_ref);

Retrieving a single job

Below is a basic example of how to make a request to retrieve a single job.

The $job_ref variable should be a string type, eg 'JO1/1'.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveJob($job_ref);

Retrieving a single invoice

Below is a basic example of how to make a request to retrieve a single invoice.

The $invoice_ref variable should be a string type, eg 'IN1/1'.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveInvoice($invoice_ref);

Retrieving a single employee

Below is a basic example of how to make a request to retrieve a single employee.

The $employee_id variable should be an integer type.

$crystal = new Crystal();
$crystal->setPkToken('{your_company_pk_token}');
$crystal->setSkToken('{your_company_sk_token}');

$crystal->retrieveEmployee($employee_id);

License

MyCrystalHub is open-sourced software licensed under the MIT license.