waitman / x2engine-client
x2engine 客户端
dev-master
2016-01-02 02:19 UTC
Requires
- php: ^7.0
This package is not auto-updated.
Last update: 2024-09-14 19:14:39 UTC
README
x2engineClient / PHP
此程序提供了一个PHP类客户端,用于连接到x2engine
许可证
版权(c)2016 Waitman Gobble ns@waitman.net。保留所有权利。
允许以源代码和二进制形式重新分发和使用,前提是上述版权声明和本段落必须复制在所有此类形式中,并且任何与此类分发和使用相关的文档、广告材料和其他材料均应承认该软件是由Waitman Gobble开发的。未经事先书面许可,Waitman Gobble的名称不得用于推广或认可由此软件派生的产品。本软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性和适用于特定目的的保证。
使用composer安装
编辑项目目录中的composer.json
{
"minimum-stability": "dev",
"require": {
"waitman/x2engine-client": "dev-master"
}
}
# composer update
示例
<?php
require_once('vendor/autoload.php'); //composer
use x2engineClient\x2engineClient;
$url = 'https://www.arduent.com/index.php/api2';
/*
optionally store auth key in /etc/x2engineAuth
otherwise create object with
$test = new x2engineClient('username','api key',$url);
*/
$access = explode('|',trim(str_replace("\r",'',str_replace("\n",'',file_get_contents('/etc/x2engineAuth')))));
$test = new x2engineClient($access[0],$access[1],$url);
echo $test."\n";
print_r($test->toArray());
echo "\n";
echo "Number Of Contacts In System: ". $test->contactsCount();
echo "\n";
echo "Show Contact 1:\n";
echo $test->contactRecord(1);
echo "\n";
print_r ($test->toArray());
echo "\n";
/* New Contact Record, Also used for Update */
$a = array(
'assignedTo' => 'administration', /* optional */
'backgroundInfo' => 'totally hot chick',
'visibility' => 1, /* 1=public */
'priority' => 3, /* 1=Low,2=Medium,3=High */
'rating' => 3, /* 0 to 5 stars */
'firstName' => 'Jessica',
'lastName' => 'Sampson',
'title' => 'Queen',
'company' => 'Electric Gadgets Co',
'address' => '123 Electric Ave',
'address2' => '',
'city' => 'San Jose',
'state' => 'CA',
'country' => 'US',
'zipcode' => '95124',
'timezone' => 'America/Los_Angeles',
'phone' => '+1 650-900-8557',
'phone2' => '',
'email' => 'gobble.wa@gmail.com',
'facebook' => '',
'googleplus' => '',
'linkedin' => '',
'otherUrl' => '',
'skype' => 'waitman.gobble',
'twitter' => '@waitman',
'website' => 'http://www.cristinaribeiro.org/',
'fingerprintId' => '',
'doNotCall' => 0, /* 0 or 1 (true) */
'doNotEmail' => 0, /* 0 or 1 (true) */
'leadDate' => strtotime('2016-01-01 06:30:00'),
'leadscore' => 5, /* 0 through 5 */
'leadSource' => 'Facebook', /* 'None','Google','Facebook','Walk In' */
'leadstatus' => '',
'leadtype' => 'In Person', /* 'None','Web','In Person','Phone','E-Mail' */
);
echo "\nCreate Contact\n";
echo $test->createContact($a);
echo "\nUpdate Contact\n";
echo $test->updateContact(2,$a);
echo "\nSearch For Contact by Email\n";
echo $test->searchContactEmail('gobble.wa@gmail.com'); /* returning unsupported media type 415, todo */
echo "\n";
print_r($test->toArray());
echo "\n";
echo "\nLast Action\n";
echo $test->lastAction(10); /* Get Last 10 Actions */
echo "\n";
echo "\nList Account 1\n";
echo $test->accountRecord(1);
echo "\n";
print_r($test->toArray());
echo "\n";
/* New Account Record, also used for update */
$a = array(
'assignedTo' => 'administration', /* optional */
'visibility' => 1, /* 1 public */
'name' => 'Test Account',
'description' => 'This is a test account',
'address' => '123 Lovely Bush Place',
'city' => 'Mahoganilia',
'state' => 'CA',
'zipcode' => '90210',
'country' => 'US',
'website' => 'http://www.arduent.com/',
'phone' => '+1 650 999 0406',
'annualRevenue' => 1000000.00,
'closedate' => 0,
'dealstatus' => 'Working', /* 'Working','Won','Lost' */
'dealvalue' => 400.44,
'employees' => 5000,
'expectedCloseDate' => strtotime('2016-03-01 08:00:00'),
'interest' => 'hot sales',
'leadDate' => strtotime('2016-01-02 08:00:00'),
'leadscore' => 5, /* 0 to 5 stars */
'leadSource' => 'Google', /* 'None','Google','Facebook','Walk In' */
'leadstatus' => 'Accepted', /* 'Unassigned','Assigned','Accepted','Working','Dead','Rejected' */
'leadtype' => 'Phone', /* 'None','Web','In Person','Phone','E-Mail' */
'rating' => 3, /* 0 to 5 stars */
'tickerSymbol' => 'testa',
'type' => 'Fun Type',
);
echo "\nCreate Account\n";
echo $test->createAccount($a);
echo "\nUpdate Account\n";
echo $test->updateAccount(2,$a);
echo "\n";