PHP SDK - An Overview

PHP SDK - An 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.

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.
  1. require ‘vendor/autoload.php’
Through this line, you can access all the functionalities of the PHP SDK.
    • Related Articles

    • Configuration - PHP SDK

      Before you get started with creating your php application, you need to first authenticate the app with Zoho. And to do that there are some configuration procedures that need to be in place. There are two methods in which you can authenticate your ...
    • Installation - PHP SDK

      Install Composer(if not installed) Run this command to install the composer curl -sS https://getcomposer.org/installer | php To install composer on mac/ linux machine: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx To install ...
    • Initialization - PHP SDK

      The app would be ready to be initialized after defining the OAuth configuration file. Generating self-authorized grant and refresh token For self client apps, the self authorized grant token should be generated from the Zoho Developer Console ...
    • PHP SDK Sample

      Here is the sample PHP code block for the getFieldDetails method. <?php require 'vendor/autoload.php'; class Module{     public function __construct()     {         ZCRMRestClient::initialize();     }     public function getFieldDetails() {         ...
    • Class Hierarchy - PHP SDK

      All Zoho CRM entities are modelled as classes having members and methods applicable to that particular entity. ZCRMRestClient is the base class of the SDK. This class has, methods to get instances of various other Zoho CRM entities. The class ...