developer-kareem-elsharkawy/zoho
Composer 安装命令:
composer require developer-kareem-elsharkawy/zoho
包简介
A fork of Asciisd Zoho, providing an elegant and easy way to communicate with Zoho CRM.
README 文档
README
This package used to integrate with the new Zoho CRM
For a new package please visit - ZohoV3
Requirements
- Get yourself a Zoho CRM account.
- Register your application
- PHP >= 7.2
- Laravel >= 6.*
Installation
Add Zoho CRM to your composer file via the composer require command:
$ composer require asciisd/zoho
Or add it to composer.json manually:
"require": { "asciisd/zoho": "^1.0" }
Zoho CRM service providers will be automatically registered using Laravel's auto-discovery feature.
Configuration
The default configuration settings set in config/zoho.php. Copy this file to your own config directory to modify the values. You can publish the config using this command:
$ php artisan zoho:install
You'll need to add the following variables to your .env file. Use the credentials previously obtained registering your application.
ZOHO_CLIENT_ID= ZOHO_CLIENT_SECRET= ZOHO_REDIRECT_URI= ZOHO_CURRENT_USER_EMAIL=
please note that for
ZOHO_REDIRECT_URIyou need to put yourapp_urlas it is in.envfile suffixed by/zoho/oauth2callbackfor ex.https://asciisd.com/zoho/oauth2callback
Then, follow the next steps:
- Go to Zoho CRM Developer Console.
- ADD CLIENT
Server-based Applications. - Enter Client Name
Any name you want - Enter Homepage URL
your base home url - Enter Authorized Redirect URIs
config('app.url') . /zoho/oauth2callback - Go to your project location on terminal and enter
php artisan zoho:authentication
- Copy the generated link and past it in the browser to complete the oAuth process.
Now Zoho CRM is ready to use.
Testing
before testing make sure to create file ZCRMClientLibrary.log on
tests/Fixture/Storage/oauth/logs/ZCRMClientLibrary.log
and put your zcrm_oauthtokens.txt on
tests/Fixture/Storage/oauth/tokens/zcrm_oauthtokens.txt
finally put your Env keys
ZOHO_CLIENT_ID= ZOHO_CLIENT_SECRET= ZOHO_REDIRECT_URI= ZOHO_CURRENT_USER_EMAIL=
How to use
use ZOHO Facade like this
use Asciisd\Zoho\Facades\ZohoManager; // we can now deals with leads module $leads = ZohoManager::useModule('Leads');
this will return an instance of ZohoModules
Model Can be used like this:-
Available only starting from v1.1.0
add Zohoable as extended class like this:-
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]; } }
so now you can use invoice like this
$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 = []);
Note: To use the Invoice like this, you must have the invoices table in your database just like you would for any Laravel model. This allows you to save data to the database and also be able to link it to the zohos table and use all the functions in Zohoable. Use the CRUD functions below if you do not intend to use the Zohoable model this way.
CRUD Can be used like this:-
READ
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');
UPDATE
// 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();
CREATE
// 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', 'test@asciisd.com'); $record->setFieldValue('Phone', '012345678910'); // create the record into zoho crm then get the created instance data $lead = $record->create()->getData();
DELETE
// find record by it's ID $lead = $leads->getRecord('3582074000002383003'); $lead->delete();
SEARCH
Word
use Asciisd\Zoho\Facades\ZohoManager; $records = ZohoManager::useModule('Leads')->searchRecordsByWord('word to be searched'); $first_record = $records[0];
Phone
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('nobody@asciisd.com'); $first_record = $records[0];
Criteria
use Asciisd\Zoho\Facades\ZohoManager; $records = ZohoManager::useModule('Leads')->searchRecordsByCriteria('(City:equals:NY) and (State:equals:Alden)'); $first_record = $records[0];
Custom
use Asciisd\Zoho\Facades\ZohoManager; $records = ZohoManager::useModule('Leads') ->where('City', 'NY') ->andWhere('State','Alden') ->search(); $first_record = $records[0];
you can also make CriteriaBuilder like this
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());
International Versions
If you're using zoho.com, you don't have to change anything.
If you're using zoho.eu, add to .env:
ZOHO_ACCOUNTS_URL=https://accounts.zoho.eu
ZOHO_API_BASE_URL=www.zohoapis.eu
If you're using zoho.com.cn, add to .env:
ZOHO_ACCOUNTS_URL=https://accounts.zoho.com.cn
ZOHO_API_BASE_URL=www.zohoapis.com.cn
License
MIT License. Copyright (c) 2020, Asciisd
Support
Contact:
asciisd.com
aemad@asciisd.com
+2-010-1144-1444
developer-kareem-elsharkawy/zoho 适用场景与选型建议
developer-kareem-elsharkawy/zoho 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「crm」 「laravel」 「Zoho」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 developer-kareem-elsharkawy/zoho 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 developer-kareem-elsharkawy/zoho 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 developer-kareem-elsharkawy/zoho 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP client for the Salesforce SOAP API
This package contains code to help you copy ZohoCRM records directly into your database.
Command-line utility for Vtiger CRM.
Zoho Sign v1 API PHP Wrapper - PHP 7.4 Ready
Library for Kommo (AmoCRM)
Laravel Package for capsule CRM integration
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-31