maidmaid / zoho
Zoho CRM 客户端库
v0.3.0
2018-04-17 05:19 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.0
- symfony/serializer: ^2.3|^3.0
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-09-15 01:48:48 UTC
README
Zoho 客户端库。需要 PHP >= 5.6。
安装
composer require maidmaid/zoho
使用
构造函数
use Maidmaid\Zoho\Client; $client = new Client('your_authtoken');
有关更多信息,请参阅官方文档中的使用认证令牌。
插入记录
将记录插入所需的 Zoho CRM 模块。
$records = $client->insertRecords($module = 'Contacts', $data = [ 10 => [ 'Last Name' => 'Holmes', 'First Name' => 'Sherlock', ] );
有关更多信息,请参阅官方文档中的insertRecords 方法。
更新记录
更新或修改 Zoho CRM 中的记录。
$records = $client->updateRecords($module, $data = [ 10 => [ 'Id' => 'the_ID', 'First Name' => 'Sherlock', ] ]);
有关更多信息,请参阅官方文档中的updateRecords 方法。
删除记录
删除所选记录。
$client->deleteRecords($module = 'Contacts', 'the_ID');
有关更多信息,请参阅官方文档中的deleteMethod 方法。
通过 ID 获取记录
通过记录 ID 获取单个记录。
$records = $client->getRecordById($module = 'Contacts', ['the_ID_1', 'the_ID_2'])
有关更多信息,请参阅官方文档中的getRecordById 方法。
获取记录
获取 API 请求中指定的所有用户数据。
从第一页获取数据
$records = $client->getRecords($module = 'Contacts')
分页获取数据
$page = 0; while ($records = $client->getRecords($module = 'Contacts', ++$page)) { }
有关更多信息,请参阅官方文档中的getRecords 方法。
搜索记录
检索符合您搜索标准的记录。
$records = $client->searchRecords($module = 'Contacts', $criteria = '(Last Name:Holmes)');
有关更多信息,请参阅官方文档中的searchRecords 方法。
获取字段
获取模块中可用的字段详情。
$fields = $client->getFields($module = 'Contacts');
有关更多信息,请参阅官方文档中的getFields 方法。
通用调用
$result = $client->call($module, $method, $params, $data)
检查错误
您可以从失败处理记录中获取最后错误。
$errors = $client->getLastErrors();
如果全局响应失败(例如,如果 API 密钥错误),所有调用都会抛出异常。
try { $results = $client->updateRecords('Contacts', $updates = []); } catch (ZohoCRMException $e) { }
许可证
Zoho 客户端库采用 MIT 许可证授权 - 有关详细信息,请参阅LICENSE 文件。