PHP SDK - Overview
PHP SDK offers a way to create client PHP applications that can be integrated with Zoho CRM. This SDK makes the access and use of necessary CRM APIs with ease. In other words, it serves as a wrapper for the REST APIs, making it easier to use the services of Zoho CRM.
The PHP SDK for Zoho CRM has been updated to the latest version (2.1.0). In case you require the documentation for the previous versions (1.x.x), you can view the PDF here.
A sample of how an SDK acts a middle ware or interface between Zoho CRM and a client PHP application.
PHP SDK allows you to:
- Exchange data between Zoho CRM and the client application where the CRM entities are modelled as classes.
- Declare and define CRM API equivalents as simple functions in your PHP application.
- Push data into Zoho CRM by accessing appropriate APIs of the CRM Service.
PHP SDK is installable through composer. Composer is a tool for dependency management in PHP. SDK expects the following from the client app.
- Client app must have PHP 5.6 or above with curl extension enabled.
- PHP SDK must be installed into client app though composer.
- The function ZCRMRestClient::initialize($configuration) must be called on startup of app.
$configuration - Contains the configuration details as a key-value pair.
- Token persistence handling (storing and utilizing the oauth tokens) can be done in three ways. File, DB and Custom persistence. To know more about that, refer to this page.
Using the SDK
Add the below line in your client app PHP files, where you would like to make use of PHP SDK.
Through this line, you can access all the functionalities of the PHP SDK. The namespaces of the class to be used must be included within the "use" statement.
For example: If ZCRMRestclient class is being used, you must add the following:
The access and refresh tokens are environment-specific and domain-specific. When you handle various environments and domains such as Production, Sandbox, or Developer and IN, CN, US, EU, or AU, respectively, you must use the access token and refresh token generated only in those respective environments and domains. The SDK throws an error, otherwise.
For example, if you generate the tokens for your Sandbox environment in the CN domain, you must use only those tokens for that domain and environment. You cannot use the tokens generated for a different environment or a domain.