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.
A point to note would be that the developer of the client application should create programming code elements along with configuration-related properties files, interface implementations, instances or objects. Authentication to access Zoho CRM APIs is through Oauth authentication mechanism. Invariably, HTTP requests and responses are taken care by SDK.
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.
- CRM API equivalents are declared and defined as simple functions in your PHP application.
- Push data into Zoho CRM, by accessing appropriate APIs of the CRM Service.
Environmental Setup
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() must be called on startup of app.
- MySQL should run in the same machine serving at the default port 3306.
- The database name should be zohooauth.
- There must be a table oauthtokens with the columns useridentifier(varchar(100)), accesstoken(varchar(100)), refreshtoken(varchar(100)), expirytime(bigint).
Note
If token_persistence_path is provided in the oauth_configuration.properties file, then persistence happens only in the file. In this case, there is no need of MySQL. Create a empty file with name, zcrm_oauthtokens.txt, in the mentioned token_persistence_path.
Using the SDK
Add the below line in your client app PHP files, where you would like to make use of PHP SDK.
- require ‘vendor/autoload.php’
Through this line, you can access all the functionalities of the PHP SDK.