oca/x2restclient
Composer 安装命令:
composer require oca/x2restclient
包简介
A rest client for x2engine crm.
README 文档
README
Add the following lines to your composer file:
{
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"guzzlehttp/guzzle": "~6.0",
"oca/x2restclient": "dev-master"
}
}
Make sure you run composer install. Watch out for update, as it will update all other composer stuff also.
Here is a basic example of how to create a contact:
<?php
// require the composer autoload file
require __DIR__ . '/vendor/autoload.php';
// set the rest client
use Oca\X2RestClient\Client as X2RestClient;
// set your env variables to craete the clietn object.
$client = new X2RestClient(getenv('X2_URL'), getenv('X2_USER'), getenv('X2_KEY'));
// set the new contacts info
$data = array('firstName' => 'test', 'lastName' => 'contact', 'email' => 'whatever@gmail.com');
// create a contact and dump the result
$contact = $client->createContact($data);
var_dump($contact); // this will contain the new contacts info you just created.
?>
$mapper for createContact() and updateContact() looks like mywebfield => x2fieldname (key is MY fieldname, value is x2's fieldname like so:
$mapper = [
'First_Name' => 'firstName',
'Last_Name' => 'lastName',
'Primary_Email' => 'email',
];
统计信息
- 总下载量: 454
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-04-07