2017 © Pedro Peláez
 

library pipedrive-php-api

PHP API for Pipedrive

image

pinvoice/pipedrive-php-api

PHP API for Pipedrive

  • Friday, September 16, 2016
  • by melvinsh
  • Repository
  • 3 Watchers
  • 7 Stars
  • 90 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 4 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

pipedrive-php-api

PHP API for Pipedrive. Work in progress!, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Status

API Implementation Documentation
Activities X X
Deals P
DealFields P
Email 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:, (*3)

``` javascript require { "pinvoice/pipedrive-php-api": "dev-master" }, (*4)

Include the composer autoloader in your script. Set your Pipedrive API token and create an instance of the API. 

``` php
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. xml <php> <env name="PIPEDRIVE_TOKEN" value="some_token"/> </php> Run tests with phpunit (-v) tests., (*5)

The Versions

16/09 2016

dev-master

9999999-dev https://github.com/Pinvoice/pipedrive-php-api

PHP API for Pipedrive

  Sources   Download

MIT

The Requires

 

by Melvin Lammerts

api pipedrive