1. Go to this page and download the library: Download mkwsra/zoho 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/ */
mkwsra / zoho example snippets
use Asciisd\Zoho\Facades\ZohoManager;
// we can now deals with leads module
$leads = ZohoManager::useModule('Leads');
use Asciisd\Zoho\Zohoable;
use Asciisd\Zoho\CriteriaBuilder;
class Invoice extends Zohoable {
// this is your Zoho module API Name
protected $zoho_module_name = 'Payments';
public function searchCriteria(){
// you should return string of criteria that you want to find current record in crm with.
//EX:
return CriteriaBuilder::where('PaymentID', $this->payment_id)
->andWhere('Order_ID', $this->order_id)
->toString();
}
public function zohoMandatoryFields() {
// you should return array of mandatory fields to create module from this model
// EX:
return ['Base_Currency' => $this->currency];
}
}
$invoice = \App\Invoice::find(1);
// to check if has zoho id stored on local database or not
$invoice->hasZohoId();
// to return the stored zoho id
$invoice->zohoId();
// that will search on zoho with provided criteria to find the record and associated your model with returned id if exist
// if you provided an `id` that will be used instead of searching on Zoho
$invoice->createOrUpdateZohoId($id = null);
// you can also send current model to zoho
// that wil use `zohoMandatoryFields` method to Serialize model to zohoObject
// Also you can pass additional fields as array to this method
$invoice->createAsZohoable($options = []);
use Asciisd\Zoho\Facades\ZohoManager;
// we can now deals with leads module
$leads = ZohoManager::useModule('Leads');
// find record by it's ID
$lead = $leads->getRecord('3582074000002383003');
// find record by it's ID
$lead = $leads->getRecord('3582074000002383003');
// Set field with new value
$lead->setFieldValue('Last_Name', 'Ahmed');
// Then call update() method
$lead = $lead->update()->getData();
// initiating a new empty instance of leads
$record = $leads->getRecordInstance();
// fill this instance with data
$record->setFieldValue('First_Name', 'Amr');
$record->setFieldValue('Last_Name', 'Emad');
$record->setFieldValue('Email', '[email protected]');
$record->setFieldValue('Phone', '012345678910');
// create the record into zoho crm then get the created instance data
$lead = $record->create()->getData();
// find record by it's ID
$lead = $leads->getRecord('3582074000002383003');
$lead->delete();
use Asciisd\Zoho\Facades\ZohoManager;
$records = ZohoManager::useModule('Leads')->searchRecordsByWord('word to be searched');
$first_record = $records[0];
use Asciisd\Zoho\Facades\ZohoManager;
$records = ZohoManager::useModule('Leads')->searchRecordsByPhone('12345678910');
$first_record = $records[0];
use Asciisd\Zoho\Facades\ZohoManager;
$records = ZohoManager::useModule('Leads')->searchRecordsByEmail('[email protected]');
$first_record = $records[0];
use Asciisd\Zoho\Facades\ZohoManager;
$records = ZohoManager::useModule('Leads')->searchRecordsByCriteria('(City:equals:NY) and (State:equals:Alden)');
$first_record = $records[0];
use Asciisd\Zoho\CriteriaBuilder;
use Asciisd\Zoho\Facades\ZohoManager;
$builder = CriteriaBuilder::where('City', 'NY')->andWhere('State','Alden')->startsWith('City', 'N');
ZohoManager::useModule('Leads')->searchRecordsByCriteria($builder->toString());
bash
$ php artisan zoho:install
bash
php artisan zoho:authentication
text
tests/Fixture/Storage/oauth/tokens/zcrm_oauthtokens.txt
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.