Configuration - PHP SDK

Configuration - PHP SDK

To access the CRM services through SDK, the client application must be first authenticated. This can be done by passing a key-value configuration pair to the initialization process.
  1. The $configuration array must be created. It will contain the authentication credentials required.
  2. The configuration array must then be passed using the "ZCRMRestClient::initialize($configuration); ".
Sample:
  1. $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
  2. ZCRMRestClient::initialize($configuration);

Configuration Array


The user must pass the configuration values as php array(key-value pair) as argument to the ZCRMRestclient::initialize($configuration); function. Below is the list of keys that are to be in the array.

Mandatory Keys
Optional Keys
client_id
applicationLogFilePath
client_secret
sandbox
redirect_uri
apiBaseUrl
currentUserEmail
apiVersion

access_type
 
accounts_url
 
persistence_handler_class
 
token_persistence_path
 
db_port
 
db_username
 
db_password

Mandatory properties
  • client_id, client_secret and redirect_uri are your OAuth client’s configurations that you get after registering your Zoho client.

  • currentUserEmail - In case of single user, this configuration can be set using "ZCRMRestClient::setCurrentUser({user_email_id})".

Note

  1. The current user email can set in one of two methods. It can be set either:
    1. Through the "currentUserEmail" key in the configuration array.
    2. Through the ZCRMRestClient::setCurrentUser({user_email_id}) line in the code.

Additional properties

  1. access_type must be set to offline only because online OAuth client is not supported by the PHP SDK as of now.

  2. apiBaseUrl  - Url to be used when calling an API. It is used to denote the domain of the user. Url may be:
    1. www.zohoapis.com (default)
    2. www.zohoapis.eu
    3. www.zohoapis.com.cn

  3. apiVersion  is "v2".

  4. accounts_url - Default value set as US domain. The value can be changed based on your domain(EU,CN).
    1. accounts.zoho.com
    2. accounts.zoho.eu
    3. accounts.zoho.com.cn

  5. sandbox - To make API calls to sandbox account , please change the value of following key to true. By default the value is false.

  6. applicationLogFilePath - The SDK stores the log information in a file.
    1. The file path of the folder must be specified in the key and the SDK automatically creates the file. The default file name is the ZCRMClientLibrary.log.
    2. In case the path isn't specified, the log file will be created inside the project.

  7. persistence_handler_class is the implementation of the ZohoOAuthPersistenceInterface.
    1. Refer to this page for more info.
Note
  • If the Optional keys are not specified, their default values will be assigned automatically.
  • The 'apiBaseUrl' and 'accounts_url' are mandatory in case the user is not in the "com" domain.

Below is an example of a PHP array containing the mandatory keys.
  1. $configuration = array("client_id"=>"value","client_secret"=>"value","redirect_uri"=>"value","currentUserEmail"=>"value");
  2. ZCRMRestClient::initialize($configuration);
Below is an example of a PHP array containing all the keys.
  1. $configuration=array("client_id"=>"value","client_secret"=>"value","redirect_uri"=>"value","currentUserEmail"=>"value","applicationLogFilePath"=>"value", "sandbox"=>"value","apiBaseUrl"=>"value","apiVersion"=>"value",access_type"=>"value","accounts_url"=>"value","persistence_handler_class"=>"value","token_persistence_path"=>"value");
  2. ZCRMRestClient::initialize($configuration);



    • Related Articles

    • Release Notes - PHP SDK

      ZOHO CRM/PHP SDK 2.0.1 Install command composer require zohocrm/php-sdk:2.0.1 Notes Enhancement Tag names can contain spaces in between them, while associating with records. Tag names can be retrieved as "ZCRMTag" objects in records function. ZOHO ...
    • 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 ...
    • 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 ...
    • Token Persistence - PHP SDK

      Token persistence refers to storing and utilizing the authentication tokens that are provided by Zoho. There are three ways provided by the SDK in which persistence can be applied. They are file persistence, DB persistence (default) and Custom ...
    • Initialization - PHP SDK

      The app would be ready to be initialized after defining the configuration array. The user can now proceed to generate the required tokens to run the app. The generation of the grant token can be done using two methods. Self-Client Redirection-based ...