beleed/php-client

此包已被放弃,不再维护。未建议替代包。
此包最新版本(dev-master)没有可用的许可证信息。

Beleed PHP 客户端

dev-master 2015-03-14 04:04 UTC

This package is not auto-updated.

Last update: 2018-03-25 14:46:00 UTC


README

创建和获取产品

<?php

use Beleed\Client\Client;
use Beleed\Client\Model\Product;
use Buzz\Client\Curl;

$product = new Product;
$product->name = 'theProdName';
$product->price = '99';

$client = new Client(new Curl, $accessToken);

$client->createProduct($product);

echo $product->id;

$fetchedProduct = $client->fetchProduct($product->id);

创建和获取联系信息

<?php

use Beleed\Client\Client;
use Beleed\Client\Model\Contact;
use Buzz\Client\Curl;

$contact = new Contact;
$contact->name = 'theOrgName';
$contact->description = 'theOrgDesc';
$contact->url = 'http://theorg.url';

$client = new Client(new Curl, $accessToken);

$client->createContact($contact);

echo $contact->id;

$fetchedContact = $client->fetchContact($contact->id);

创建和获取机会

使用新产品和联系信息

<?php

use Beleed\Client\Client;
use Beleed\Client\Model\Opportunity;
use Beleed\Client\Model\Contact;
use Beleed\Client\Model\Product;
use Buzz\Client\Curl;

$contact = new Contact;
$contact->name = 'theOrgName';
$contact->description = 'theOrgDesc';
$contact->url = 'http://theorg.url';

$product = new Product;
$product->name = 'theProdName';
$product->price = '99';

$opportunity = new Opportunity;
$opportunity->comment = 'aComment';
$opportunity->status = 'active';
$opportunity->confidence = '50';
$opportunity->value = '500';
$opportunity->contact = $contact;
$opportunity->product = $product;

$client = new Client(new Curl, $accessToken);

$client->createOpportunity($opportunity);

echo $opportunity->id;

$fetchedOpportunity = $client->fetchOpportunity($opportunity->id);

使用现有产品和使用联系信息

<?php

use Beleed\Client\Client;
use Beleed\Client\Model\Opportunity;
use Beleed\Client\Model\Contact;
use Beleed\Client\Model\Product;
use Buzz\Client\Curl;

$client = new Client(new Curl, $accessToken);

$product = $client->fetchProduct('aProductId');
$contact = $client->fetchContact('aOrganizationId');

$opportunity = new Opportunity;
$opportunity->comment = 'aComment';
$opportunity->status = 'active';
$opportunity->confidence = '50';
$opportunity->value = '500';
$opportunity->contact = $contact;
$opportunity->product = $product;

$client->createOpportunity($opportunity);

echo $opportunity->id;

$fetchedOpportunity = $client->fetchOpportunity($opportunity->id);

仅使用现有产品和使用联系信息 ID

<?php

use Beleed\Client\Client;
use Beleed\Client\Model\Opportunity;
use Beleed\Client\Model\Contact;
use Beleed\Client\Model\Product;
use Buzz\Client\Curl;

$client = new Client(new Curl, $accessToken);

$opportunity = new Opportunity;
$opportunity->comment = 'aComment';
$opportunity->status = 'active';
$opportunity->confidence = '50';
$opportunity->value = '500';
$opportunity->contact_id = 'aContactId';
$opportunity->product_id = 'aProductId';

$client->createOpportunity($opportunity);

echo $opportunity->id;

$fetchedOpportunity = $client->fetchOpportunity($opportunity->id);