mctekk/zohocrm
Composer 安装命令:
composer require mctekk/zohocrm
包简介
Wrapper for interact with Zoho CRM API for php
README 文档
README
The Zoho CRM library is a simple wrapper around Zoho API
At MC we work a lot with Zoho and we found ourself repeating the same patter over and over that's why we build this library.
Installation
Using composer, execute the following command to add the requirement to your composer.json
$ composer require mctekk/zohocrm:^0.1
Let's start
Zoho API V2 has change the wey they handle connecto to the API, it now uses OAuth instead of just simple private and public keys. So you will have to do the following things to get this package to work with your app
- Register a Zoho Client via its Developer Console [https://api-console.zoho.com/]
- Make sure to elect Web Based App and Follow this tutorial https://www.zoho.com/crm/developer/docs/api/register-client.html
- Once you have the Client ID and Its Secret we will need to generate a refresh_token
- To generate the refresh_token you will need to visit , change {client_id} with the client id and redirect_uri with the value you configure the cliente
- This URL will redirect to the client URI with a query string code
- Take the code query string and make a POST https://accounts.zoho.com/oauth/v2/token sending
- grant_type : authorization_code
- client_id : {client_id}
- client_secret : {client_secret}
- redirect_uri : {redirect_uri}
- code : {code}
- This final request will provide you with the refresh_token .
- Take into consideration refresh_token could be consider the identifier of the zoho account you are interacting with
- Set client_id, client_secret and refresh_token on .env and the package will handle the rest
Todo In future version we will add the refresh_token generator directly as a php script
<?php use Zoho\CRM\ZohoClient; $ZohoClient = new ZohoClient(); // Make the connection to zoho api $ZohoClient->setAuthRefreshToken(getenv('ZOHO_AUTH_REFRESH_TOKEN')); $ZohoClient->setZohoClientId(getenv('ZOHO_CLIENT_ID')); $ZohoClient->setZohoClientSecret(getenv('ZOHO_CLIENT_SECRET')); $refresh = $ZohoClient->generateAccessTokenByRefreshToken(); //or with redis $ZohoClient->manageAccessTokenRedis($redis); $this->zohoClient->setModule('Leads'); $lead = new Lead(); $leadRequest = [ 'First_Name' => 'Test', 'Last_Name' => 'Zoho', 'Phone' => '000000000', 'Email' => 'testzoho@mctekk.com' ]; $response = $this->zohoClient->insertRecords( $leadRequest, ['wfTrigger' => 'true'] ); $response->getResponseData();
The above values of the $request array can be taken from POST if you are using forms in landing page :D, just be sure that all the keys(name of the field on html) in the array have to be valid properties in the entity Lead of zoho, default properties can be found on documentation here or make sure that those properties exist in your account if you custom your Lead on Zoho; the following convention are made:
- Name of fields are not CamelCase.
- Name with space between words, space is substituted by an "_".
- Need to clean(unset) from the array all the values that are not part of the entity, if you don't wanna make this, create another clean array.
Users of the .eu domain (i.e. your CRM URL is crm.zoho.eu, rather than crm.zoho.com) should call setEuDomain() after instantiating ZohoClient, i.e.
$ZohoClient = new ZohoClient(); // Make the connection to zoho api $ZohoClient->setAuthRefreshToken(getenv('ZOHO_AUTH_REFRESH_TOKEN')); $ZohoClient->setZohoClientId(getenv('ZOHO_CLIENT_ID')); $ZohoClient->setZohoClientSecret(getenv('ZOHO_CLIENT_SECRET')); $refresh = $ZohoClient->generateAccessTokenByRefreshToken(); $ZohoClient->setEuDomain(); $ZohoClient->setModule('Leads'); // Set the module
mctekk/zohocrm 适用场景与选型建议
mctekk/zohocrm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 70.57k 次下载、GitHub Stars 达 51, 最近一次更新时间为 2014 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Zoho CRM API PHP Wrapper」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mctekk/zohocrm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mctekk/zohocrm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mctekk/zohocrm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP client for the Salesforce SOAP API
This package contains code to help you copy ZohoCRM records directly into your database.
A PSR-7 compatible library for making CRUD API endpoints
Command-line utility for Vtiger CRM.
Zoho Sign v1 API PHP Wrapper - PHP 7.4 Ready
Library for Kommo (AmoCRM)
统计信息
- 总下载量: 70.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 52
- 点击次数: 20
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-21