1. Go to this page and download the library: Download devio/pipedrive library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devio / pipedrive example snippets
$token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$pipedrive = new Pipedrive($token);
// Easily access a Pipedrive resource and its values
$organization = $pipedrive->organizations->find(1);
var_dump($organization->getData());
// Also simple to update any Pipedrive resource value
$organization = $pipedrive->organizations->update(1, ['name' => 'Big Code']);
var_dump($organization->getData());
// Keep reading this documentation to find out more.
$token = 'PipedriveTokenHere';
$pipedrive = new Pipedrive($token);
$pipedrive = Pipedrive::OAuth([
'clientId' => '<your-client-id>',
'clientSecret' => '<your-client-secret>',
'redirectUrl' => '<your-redirect-url>',
'storage' => new PipedriveTokenIO() // This is your implementation of the PipedriveTokenStorage interface (example below)
]);
class PipedriveTokenIO implements \Devio\Pipedrive\PipedriveTokenStorage
{
public function setToken(\Devio\Pipedrive\PipedriveToken $token) {
$_SESSION['token'] = serialize($token); // or encrypt and store in the db, or anything else...
}
public function getToken() { // Returns a PipedriveToken instance
return isset($_SESSION['token']) ? unserialize($_SESSION['token']) : null;
}
}
public function setToken(\Devio\Pipedrive\PipedriveToken $token) {
$token->getAccessToken(); // save it individually
$token->getRefreshToken(); // save it individually
$token->expiresAt(); // save it individually
}
$token = new \Devio\Pipedrive\PipedriveToken([
'accessToken' => 'xxxxx', // read it individually from the db
'refreshToken' => 'xxxxx', // read it individually from the db
'expiresAt' => 'xxxxx', // read it individually from the db
]);