pinvoice / pipedrive-php-api
Pipedrive 的 PHP API
dev-master
2016-09-16 11:53 UTC
Requires
- curl/curl: 1.1.5
- zendframework/zend-filter: 2.3.3
- zendframework/zend-validator: 2.3.3
This package is not auto-updated.
Last update: 2024-09-28 15:49:40 UTC
README
Pipedrive 的 PHP API。正在进行中!
状态
安装
在您的 composer.json
文件中将包添加为依赖项
require { "pinvoice/pipedrive-php-api": "dev-master" }
在您的脚本中包含 composer 自动加载器。设置您的 Pipedrive API 令牌并创建 API 实例。
require 'vendor/autoload.php'; use Pinvoice\Pipedrive\API as PipedriveAPI; $pipedrive = new PipedriveAPI(getenv('PIPEDRIVE_TOKEN'));
用法
交易
// Get all deals $pipedrive->deals->getDeals(); // Get all deals, with optional filters $pipedrive->deals->getDeals(array( 'filter_id' => 12, 'start' => 3, 'limit' => 1, 'sort_by' => 'first_name', 'sort_mode' => 'asc', 'owned_by_you' => true )); // Get deal by ID $pipedrive->deals->getDeal(70); // Find deals by name $pipedrive->deals->getDealsByName(array( 'term' => 'money' )); // Find deals by name, with optional filters $pipedrive->deals->getDealsByName(array( 'term' => 'money', 'person_id' => 1, 'org_id' => 2 ));
交易字段
// Get all deal fields $dealfields = $pipedrive->dealfields->getDealFields(); // Get deal field object by key (from deal fields set) $field = $pipedrive->dealfields->getDealFieldByKey('109204dc0283d5ced6c0438f8b7a220ecac9238d', $dealfields); // Translate custom fields in Deal object(s), keys to text // For example, this will replace $deal->109204dc0283d5ced6c0438f8b7a220ecac9238d with $deal->test $deals = $pipedrive->deals->getDeals(); foreach ($deals as $deal) { $pipedrive->dealfields->translateDealFieldKeys($deal); }
人员
// Get all persons $pipedrive->persons->getPersons(); // Get all persons, with optional filters $pipedrive->persons->getPersons(array( 'filter_id' => 12, 'start' => 3, 'limit' => 1, 'sort_by' => 'first_name', 'sort_mode' => 'asc' )); // Get person by ID $pipedrive->persons->getPerson(70); // Find person by name $pipedrive->persons->getPersonsByName(array( 'term' => 'Junior' )); // Find persons by name, with optional filters $pipedrive->persons->getPersonsByName(array( 'term' => 'Junior', 'person_id' => 1, 'org_id' => 2, 'start' => 1, 'limit' => 1, 'search_by_email' => false ));
人员字段
// Get all person fields $personfields = $pipedrive->personfields->getPersonFields(); // Get person field object by key (from person fields set) $field = $pipedrive->personfields->getPersonFieldByKey('109204dc0283d5ced6c0438f8b7a220ecac9238d', $personfields); // Translate custom fields in Person object(s), keys to text // For example, this will replace $person->109204dc0283d5ced6c0438f8b7a220ecac9238d with $person->test $persons = $pipedrive->persons->getPersons(); foreach ($persons as $person) { $pipedrive->personfields->translatePersonFieldKeys($person); }
管道
// Get all pipelines $pipedrive->pipelines->getPipelines(); // Get pipeline by ID $pipedrive->pipelines->getPipeline(1);
阶段
// Get all stages $pipedrive->stages->getStages(); // Get stage by ID $pipedrive->stages->getStage(70); // Returns stages for provided pipeline $pipedrive->stages->getStagesByPipelineId(1);
测试
将 PIPEDRIVE_TOKEN
放入您的环境变量中。或者,在 phpunit.xml
中放入以下内容。
<php> <env name="PIPEDRIVE_TOKEN" value="some_token"/> </php>
使用 phpunit (-v) tests
运行测试。