MyCrystalHub SDK
PHP-SDK for MyCrystalHub API
Used to access your companies data., (*1)
Usage
Pull in the composer package by running the command below:, (*2)
composer require oliveris/sdk-mycrystalhub
Import the Crystal namespace into the class (autoloading), (*3)
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., (*4)
$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., (*5)
$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., (*6)
$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., (*7)
$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., (*8)
$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., (*9)
$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., (*10)
The $client_id variable should be an integer type., (*11)
$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., (*12)
The $quote_ref variable should be a string type, eg 'QU1/1'., (*13)
$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., (*14)
The $job_ref variable should be a string type, eg 'JO1/1'., (*15)
$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., (*16)
The $invoice_ref variable should be a string type, eg 'IN1/1'., (*17)
$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., (*18)
The $employee_id variable should be an integer type., (*19)
$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., (*20)