PHP code example of zcc / cc-php-sdk

1. Go to this page and download the library: Download zcc/cc-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zcc / cc-php-sdk example snippets


     

    /*
    * Configure the environment
    * which is of the pattern Domain::Environment
    * Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
    * Available Environments: PRODUCTION()
    */
    $environment = USDataCenter::PRODUCTION();
    

    /*
    * By default, the SDK creates the SDKConfig instance
    */

    $sdkConfig = (new SDKConfigBuilder())->build();
    

use com\zoho\crm\api\InitializeBuilder;

use com\zoho\crm\api\dc\USDataCenter;

use com\zoho\crm\api\SDKConfigBuilder;

class PFSDKInitialize
{
    public static function initialize()
    {
   /*
    * Configure the environment
    * which is of the pattern Domain::Environment
    * Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
    * Available Environments: PRODUCTION()
    */
    $environment = USDataCenter::PRODUCTION();

    $sdkConfig = (new SDKConfigBuilder())->build();

   /*
    * Set the following in InitializeBuilder
    * environment -> Environment instance
    * SDKConfig -> SDKConfig instance
    */
    (new InitializeBuilder())
            ->environment($environment)
            ->SDKConfig($sdkConfig)
            ->initialize();
    }
}

PFSDKInitialize::initialize();


use com\zoho\dc\USDataCenter;
use com\zoho\InitializeBuilder;
use com\zoho\SDKConfigBuilder;
use com\zoho\crm\apitrigger\GetAPITriggerParam;
use com\zoho\crm\apitrigger\ApiTriggerOperations;
use com\zoho\Param;

use com\zoho\ParameterMap;

ataCenter, AUDataCenter
        * Available Environments: PRODUCTION()
        */
        $environment = USDataCenter::PRODUCTION();
        $sdkConfig = (new SDKConfigBuilder())->build();

        (new InitializeBuilder())
            ->environment($environment)
            ->SDKConfig($sdkConfig)
            ->initialize();
    
        try {
            //Pass Processname, Statename, Digestkey configured in the CRM PathFinder and pass dynamic Identifiers and Params to that PathFinder Process
            $paramInstance = new ParameterMap();
            $paramInstance->add(GetAPITriggerParam::PROCESSNAME(), "sdkprocess");
            $paramInstance->add(GetAPITriggerParam::STATENAME(), "state1");
            $paramInstance->add(GetAPITriggerParam::ZGID(), "15542307");
            $paramInstance->add(GetAPITriggerParam::IDENTIFIER3(), "test1");
            $paramInstance->add(GetAPITriggerParam::IDENTIFIER4(), "test2");
            $paramInstance->add(GetAPITriggerParam::IDENTIFIER5(), "test3");
            //Supported dataTypes for Param: String, Integer, Boolean, DateTime, Date
            $paramInstance->add(new Param("stringparam!", "string"), "xyz");
            $paramInstance->add(new Param("integerparam", "Integer"), 10);
            // $paramInstance->add(new Param("booleanparam", "Boolean"), false);
            // $paramInstance->add(new Param("datetimeparam", "DateTime"), date(DATE_ATOM, mktime(13, 30, 20, 8, 11, 2022)));
            // $paramInstance->add(new Param("dateparam", "Date"), date_create("2022-11-10"));
            
            $primaryOperations = new ApiTriggerOperations();
            //Checks the response of an API
            $response = $primaryOperations->getAPITriggerWithParam($paramInstance);

            print_r($response->getObject()->getMessage());

        }catch(\Exception $exception) {
            print_r($exception);
        }
        
        echo("\n");
    }
}
PFSDKInitialize::initialize();
sh
    curl -sS https://getcomposer.org/installer | php