PHP code example of asad / laravel-zoho-api-wrapper

1. Go to this page and download the library: Download asad/laravel-zoho-api-wrapper 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/ */

    

asad / laravel-zoho-api-wrapper example snippets


> ZohoController.php

use Asad\Zoho\Api\RecordApi;
use Asad\Zoho\Exception\ZohoException;

Class ZohoController extends Controller
{

    public function testAPI()
    {
        $param = [
            'headers' => [
                'If-Modified-Since' => date('c')
            ],
            'data' => [
                'page' => 1,
                'per_page' => 20,
            ]
        ];

        $response = $this->listOfRecords('Leads', $param);
        dd($response);
    }

    public function listOfRecords($module, array $param)
    {
        $record_api = new RecordApi();
        try {
            $response = $record_api->listOfRecords($module, $param);
            if ($response->getStatus() == 'success') {
                $crm_data = $response->getResults();
                return $crm_data;
            }
        } catch(ZohoException $e) {
            // Handle Exception and return
        }
    }
}