mjmarianetti/zoho 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mjmarianetti/zoho

Composer 安装命令:

composer require mjmarianetti/zoho

包简介

PHP wrapper for ZoHo API

README 文档

README

PHP wrapper for Zoho with Laravel 5.* support

PACKAGE UNDER DEVELOPMENT, NOT ALL METHODS DOCUMENTED

Installation

To install this package you must modify your composer.json file and run composer update

"require": {
    "mjmarianetti/zoho": "dev-master"
  }

Or you can run the composer require mjmarianetti/zoho-php

Laravel

Open config/app.php and register the required service provider

'providers' => [
  ...
  Mjmarianetti\Zoho\ZohoServiceProvider::class

]

Then you should publish the config file

php artisan vendor:publish --provider="Mjmarianetti\Zoho\ZohoServiceProvider"

Configuration

You can configure the options provided in you .env file.

ZOHO_SCOPE=crmapi
ZOHO_AUTHTOKEN=<INSERT-YOUR-TOKEN-HERE>
ZOHO_FORMAT=json

The default options are:

ZOHO_SCOPE=crmapi
ZOHO_FORMAT=json

Usage

Initialization

Include the ZohoClient in your project/file

use Mjmarianetti\Zoho\ZohoClient;

If you are using Laravel you can inject it as a dependency

public function test(ZohoClient $client)
{

Or if you are using it as a stand-alone library or with another framework, you have to provide a default configuration like:

$config = [
  'authtoken' => 'YOUR-TOKEN',
  'scope' => 'crmapi',
  'format' => 'json', // or xml
  'baseurl' => 'https://crm.zoho.com/crm/private/'
];

$client = new ZohoClient($config);

Methods

After initialization you can call the API.

All this methods follow the same pattern, where $resource is the Module you want to call, and $params all the parameters that you want to use.

The response returned usually follows the pattern:

$result = $client->getRecords(RESOURCE,$params);

$result->response->nodata;
$result->response->result->FL
$result->response->result->RESOURCE->row

Available $resource values

API format --> https://www.zoho.com/crm/help/api/modules-fields.html

getRecords

https://www.zoho.com/crm/help/api/getrecords.html

$client->getRecords($resource, $params = [])

getRecordsById

https://www.zoho.com/crm/help/api/getrecordbyid.html

$params should contain either id or idlist value.

$client->getRecordsById($resource, $params = [])

Note: idlist should be a unique set of Ids separated by semicolon, up to 100 values

getMyRecords

https://www.zoho.com/crm/help/api/getmyrecords.html

$client->getMyRecords($resource, $params = [])

getDeletedRecordIds

https://www.zoho.com/crm/help/api/getdeletedrecordids.html

$client->getDeletedRecordIds($resource, $params = [])

//response->result->DeletedIDs;

getSearchRecordsByPDC

https://www.zoho.com/crm/help/api/getsearchrecordsbypdc.html

$client->getSearchRecordsByPDC($resource, $params = [])

deleteRecords

https://www.zoho.com/crm/help/api/deleterecords.html

  $client->deleteRecords($resource, $params = [])

getRelatedRecords

https://www.zoho.com/crm/help/api/getrelatedrecords.html

$client->getRelatedRecords($resource, $params = [])

getFields

https://www.zoho.com/crm/help/api/getfields.html

$client->getFields($resource, $params = [])

getUsers

https://www.zoho.com/crm/help/api/getusers.html

$client->getUsers($resource, $params = [])

delink

https://www.zoho.com/crm/help/api/delink.html

$client->delink($resource, $params = [])

downloadFile

https://www.zoho.com/crm/help/api/downloadfile.html

$client->downloadFile($resource, $params = [])

deleteFile

https://www.zoho.com/crm/help/api/deletefile.html

$client->deleteFile($resource, $params = [])

downloadPhoto

https://www.zoho.com/crm/help/api/downloadphoto.html

$client->downloadPhoto($resource, $params = [])

deletePhoto

https://www.zoho.com/crm/help/api/deletephoto.html

$client->deletePhoto($resource, $params = [])

getModules

https://www.zoho.com/crm/help/api/getmodules.html

$client->getModules($resource, $params = [])

searchRecords

https://www.zoho.com/crm/help/api/searchrecords.html

$client->searchRecords($resource, $params = [])

Iterator

If you would like to use a iterator to loop through the data received, you can use it like this:

use Mjmarianetti\Zoho\Helpers\ZohoResponseIterator;
use Mjmarianetti\Zoho\ZohoClient;

...
$response = $zc->getRecords('Accounts', []);

$it = new ZohoResponseIterator((array) $response->response->result->Accounts->row);
foreach ($it as $key => $value) {
    //$value->val and $value->content;      
}

For now, you should check that $response->response->result->Resource->row is not null

统计信息

  • 总下载量: 150
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固