PHP code example of christiaan / zohocrmclient

1. Go to this page and download the library: Download christiaan/zohocrmclient 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/ */

    

christiaan / zohocrmclient example snippets


use Christiaan\ZohoCRMClient\ZohoCRMClient;

$client = new ZohoCRMClient('Leads', 'yourAuthKey');

$records = $client->getRecords()
    ->selectColumns('First Name', 'Last Name', 'Email')
    ->sortBy('Last Name')->sortAsc()
    ->since(date_create('last week'))
    ->request();

echo 'Content: ' . print_r($records, true) . PHP_EOL;

$client->setLogger($myPsrLogger);

$buzzTransport = new BuzzTransport(
    new \Buzz\Browser(new \Buzz\Client\Curl()),
    'https://crm.zoho.com/crm/private/xml/'
);
$buzzTransport->setLogger($logger);

$transport = new XmlDataTransportDecorator(
    new AuthenticationTokenTransportDecorator(
        'yourAuthKey',
        $buzzTransport
    )
);

$client = new ZohoCRMClient('Leads', $transport);

use Christiaan\ZohoCRMClient\ZohoCRMClient;

$client = new ZohoCRMClient('Contacts', 'yourAuthKey');

$records = $client
            ->insertRecords()
            ->addRecord([
                'Email' => '[email protected]',
                'First Name' => 'John'
            ])
            ->request();

use Christiaan\ZohoCRMClient\ZohoCRMClient;

$client = new ZohoCRMClient('Contacts', 'yourAuthKey');

$records = $client
            ->updateRecords()
            ->addRecord([
                'Id' => '(ID returned from insert, search, ...)'
                'Last Name' => 'Smith'
            ])
            ->request();

use Christiaan\ZohoCRMClient\ZohoCRMClient;

$client = new ZohoCRMClient('Contacts', 'yourAuthKey');

$records = $client
            ->searchRecords()
            ->criteria('Email:[email protected]')
            ->request();
 php
$client = new ZohoCRMClient('Leads', 'yourAuthKey', 'eu');