承接 wabel/zoho-crm-orm 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

wabel/zoho-crm-orm

Composer 安装命令:

composer require wabel/zoho-crm-orm

包简介

An ORM like package used to manipulate data from your Zoho CRM Account through the API.

README 文档

README

Scrutinizer Code Quality Build Status Coverage Status

Wabel's Zoho-CRM ORM

Heavily forked from mctekk's work

What is this?

This project is a PHP connector to Zoho CRM. Use this connector to access ZohoCRM data from your PHP application.

Who is it different from other connectors?

Unlike other Zoho CRM clients, the Zoho-CRM ORM uses a code generator to generate Beans and DAOs to easily access Zoho objects from PHP.

Beans and DAOs?

A small bit of code is better than a long phrase, here you go with a sample:

use \Wabel\Zoho\CRM\ZohoClient;

// The ZohoClient class is the low level class used to access Zoho.
$zohoClient = new ZohoClient($configuration, 'Europe/Paris');

// Use the "DAO" class to write to some module of Zoho.
// Each module (even custom ones) has its own class.
$contactZohoDao = new ContactZohoDao($zohoClient);

// For each DAO, there is a bean associated.
$contact = new Contact();
$contact->setLastName("Doe");
$contact->setFirstName("John");

// Use the "save" method to save the bean.
$contactDao->save($contact);

// Use the "searchRecords" method to fetch data from Zoho. 
$records = $contactDao->searchRecords("(Last Name:FooBar)");
foreach ($records as $record) {
    // Each record is a "Contact" object.
    echo $record->getLastName();
}

// Get Records from the dao
$contactDao->getRecords()

What you must always remember:

  • Beans are used to map records in Zoho. There is one class per Zoho module
  • DAOs are used to send beans to Zoho. There is one DAO per Zoho module

But how do I generate Beans and DAOs?

There are several techniques.

Using pure PHP code:

use \Wabel\Zoho\CRM\ZohoClient;

// The ZohoClient class is the low level class used to access Zoho.
$zohoClient = new ZohoClient($zohoAuthToken);

// The EntitiesGeneratorService class is in charge of generating Beans and DAOs.
$entitiesGenerator = new EntitiesGeneratorService($client);

// The target directory we will write into.
$directory = __DIR__.'/src/TestNamespace/';
// The namespace for the beans and DAOs.
$namespace = 'TestNamespace';
// That returns an array containing each created Dao by using the fully qualified class name
$generator->generateAll($directory, $namespace);

Targetting the correct Zoho API

Out of the box, the client will point to the https://crm.zoho.com/crm/private endpoint. If your endpoint is different (some users are pointing to https://crm.zoho.eu/crm/private), you can use the third parameter of the Client constructor:

$zohoClient = new ZohoClient([
    'client_id' => 'xxxxxxxxxxxxxxxxxxxxxx',
     'client_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'redirect_uri' => 'http://xxxxxxxxx.com/bakcxxxx',
    'currentUserEmail' => 'xxxxx@test.fr',
    'applicationLogFilePath' => '/xxx/xxx/',
    'sandbox' => true or false,
    'apiBaseUrl' => '',
    'apiVersion' => '',
    'access_type' => '',
    'accounts_url' => '',
    'persistence_handler_class' => '',
    'token_persistence_path' => ''
], 'Europe/Paris);

Setting up unit tests

Interested in contributing? You can easily set up the unit tests environment: Read how to change the client configuration - read Configuration

  • copy the phpunit.xml.dist file into phpunit.xml
  • change the stored environment variable client_secret
  • change the stored environment variable redirect_uri
  • change the stored environment variable currentUserEmail
  • change the stored environment variable applicationLogFilePath
  • change the stored environment variable persistence_handler_class
  • change the stored environment variable token_persistence_path
  • change the stored environment variable userid_test
  • change the stored environment variable timeZone
  • change the stored environment variable custom_module_singular_name
  • change the stored environment variable custom_module_mandatory_field_name
  • change the stored environment variable custom_module_picklist_field_name
  • change the stored environment variable custom_module_picklist_field_value1
  • change the stored environment variable custom_module_picklist_field_value2
  • change the stored environment variable custom_module_date_field_name
  • change the stored environment variable custom_module_text_field_name

TODO

Implement searchRecords()

统计信息

  • 总下载量: 28.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 17
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-03-05