PHP bindings to the Nimble CRM API
This library requires PHP 7.1 and later
The recommended way to install nimble php is through Composer:
This library is intended to speed up development time but is not a shortcut to reading the Nimble API documentation. Many endpoints require specific and required fields for successful operation. Always read the documentation before using an endpoint.
composer require mckltech/nimble-php
Initialize your client using your access token:
use Nimble\NimbleClient;
$client = new NimbleClient('API_ACCESS_KEY_XXXX');
- You can find your API Key by following the Nimble API documentation: https://support.nimble.com/en/articles/502755-nimble-api-access
This library is unofficial and is not endorsed or supported by Nimble.
For bugs and issues, open an issue in this repo and feel free to submit a PR. Any issues that do not contain full logs or explainations will be closed. We need you to help us help you!
This library is intended to work with Version 1.3 of the Nimble Public API
/** List Contacts */
$client->contacts->list();
/** Find Contact By Email */
$client->contacts->findBy('[email protected]');
/** Create A Contact */
$options = ['last name' => [['value' => 'Smith']], 'first name' => [['value' => 'Nimble']], 'email' => [['value' => '[email protected]']]];
$payload = ['fields' => $options];
$client->contacts->create($payload);
All endpoints follow a similar mechanism to the examples show above. Again, please ensure you read the Nimble API documentation prior to use as there are numerous required fields for most POST/PUT operations.
- Contacts
- Users
- Company
- Tasks
Exceptions are handled by HTTPlug. Every exception thrown implements Http\Client\Exception
. See the http client exceptions and the client and server errors. If you want to catch errors you can wrap your API call into a try/catch block:
try {
$users = $client->contacts->list();
} catch(Http\Client\Exception $e) {
if ($e->getCode() == '404') {
// Handle 404 error
return;
} else {
throw $e;
}
}
The layout and methodology used in this library is courtesy of https://github.com/intercom/intercom-php