Used to access your companies data.
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;
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');
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();
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();
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();
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();
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();
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);
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);
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);
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);
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);
MyCrystalHub is open-sourced software licensed under the MIT license.