pinvoice / pipedrive-php-api
PHP API for Pipedrive
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: 2023-12-09 11:33:15 UTC
README
PHP API for Pipedrive. Work in progress!
Status
API | Implementation | Documentation |
---|---|---|
Activities | X | X |
Deals | P | √ |
DealFields | P | √ |
X | X | |
Files | X | X |
Notes | X | X |
Organizations | X | X |
Persons | P | √ |
PersonFields | P | √ |
Pipelines | P | √ |
Products | X | X |
Stages | P | √ |
Installation
Add the package as a dependency in your composer.json
file:
require { "pinvoice/pipedrive-php-api": "dev-master" }
Include the composer autoloader in your script. Set your Pipedrive API token and create an instance of the API.
require 'vendor/autoload.php'; use Pinvoice\Pipedrive\API as PipedriveAPI; $pipedrive = new PipedriveAPI(getenv('PIPEDRIVE_TOKEN'));
Usage
Deals
// 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 ));
DealFields
// 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); }
Persons
// 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 ));
PersonFields
// 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); }
Pipelines
// Get all pipelines $pipedrive->pipelines->getPipelines(); // Get pipeline by ID $pipedrive->pipelines->getPipeline(1);
Stages
// Get all stages $pipedrive->stages->getStages(); // Get stage by ID $pipedrive->stages->getStage(70); // Returns stages for provided pipeline $pipedrive->stages->getStagesByPipelineId(1);
Testing
Put PIPEDRIVE_TOKEN
in your environment. Or put the following in phpunit.xml
.
<php> <env name="PIPEDRIVE_TOKEN" value="some_token"/> </php>
Run tests with phpunit (-v) tests
.