PHP code example of chi-teck / zoho-crm-connector

1. Go to this page and download the library: Download chi-teck/zoho-crm-connector 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/ */

    

chi-teck / zoho-crm-connector example snippets


 declare(strict_types = 1);

use GuzzleHttp\Client;
use ZohoCrmConnector\Config;
use ZohoCrmConnector\Connector;
use ZohoCrmConnector\Auth\Storage\FileStorage;
use ZohoCrmConnector\Auth\AccessTokenProvider;


  clientSecret: '••••••••••••••••••••••••••••••••••••••••••',
  authToken: '•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••',
);

$storage = new FileStorage(__DIR__ . '/path/to/zoho-token');
$token_provider = new AccessTokenProvider($config, $storage, new Client());

$connector = new Connector($token_provider);

// Retrieving data.
$response = $connector->get('Leads?fields=Last_Name&per_page=5');
print_r($response->decode());

// Posting data.
$data = [
    [
      "First_Name" => "Mickey",
      "Last_Name" => "Mouse",
    ],
];
$response = $connector->post('Leads', ['data' => $data]);
print_r($response->decode());