2017 © Pedro Peláez
 

library hubspot-php

HubSpot PHP API client

image

felixmaier1989/hubspot-php

HubSpot PHP API client

  • Friday, February 9, 2018
  • by felixmaier1989
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5,278 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 93 Forks
  • 0 Open issues
  • 34 Versions
  • 109 % Grown

The README.md

HubSpot PHP API client

Version Total Downloads License, (*1)

Hubspot API client. The sequel to my perfectly functional wrapper of HubSpot/haPihP. client. However, this is a complete re-write and includes some of the new COS/v2 endpoints., (*2)

Setup

Composer:, (*3)

composer require "ryanwinchester/hubspot-php:~1.0"

Quickstart

Examples Using Factory

All following examples assume this step., (*4)

$hubspot = SevenShores\Hubspot\Factory::create('api-key');

// OR instantiate by passing a configuration array.
// The only required value is the 'key'

$hubspot = new SevenShores\Hubspot\Factory([
  'key'      => 'demo',
  'oauth'    => false, // default
  'base_url' => 'https://api.hubapi.com' // default
]);

Note: You can prevent any error handling provided by this package by passing following options into client creation routine: (applies also to Factory::create() and Factory::createWithToken()), (*5)

$hubspot = new SevenShores\Hubspot\Factory([
  'key'      => 'demo',
  'oauth'    => false, // default
  'base_url' => 'https://api.hubapi.com' // default
],
null,
[
  'http_errors' => false // pass any Guzzle related option to any request, e.g. throw no exceptions
],
false // return Guzzle Response object for any ->request(*) call
);

By setting http_errors to false, you will not receive any exceptions at all, but pure responses. For possible options, see http://docs.guzzlephp.org/en/latest/request-options.html., (*6)

Get a single contact:

$contact = $hubspot->contacts()->getByEmail("test@hubspot.com");

echo $contact->properties->email->value;

Paginate through all contacts:

// Get an array of 10 contacts
// getting only the firstname and lastname properties
// and set the offset to 123456
$response = $hubspot->contacts()->all([
    'count'     => 10,
    'property'  => ['firstname', 'lastname'],
    'vidOffset' => 123456,
]);

Working with the data is easy!, (*7)

foreach ($response->contacts as $contact) {
    echo sprintf(
        "Contact name is %s %s." . PHP_EOL,
        $contact->properties->firstname->value,
        $contact->properties->lastname->value
    );
}

// Info for pagination
echo $response->{'has-more'};
echo $response->{'vid-offset'};

or if you prefer to use array access?, (*8)

foreach ($response['contacts'] as $contact) {
    echo sprintf(
        "Contact name is %s %s." . PHP_EOL,
        $contact['properties']['firstname']['value'],
        $contact['properties']['lastname']['value']
    );
}

// Info for pagination
echo $response['has-more'];
echo $response['vid-offset'];

Now with response methods implementing PSR-7 ResponseInterface, (*9)

$response->getStatusCode()   // 200;
$response->getReasonPhrase() // 'OK';
// etc...

Example Without Factory

<?php

require 'vendor/autoload.php';

use SevenShores\Hubspot\Http\Client;
use SevenShores\Hubspot\Resources\Contacts;

$client = new Client(['key' => 'demo']);

$contacts = new Contacts($client);

$response = $contacts->all();

foreach ($response->contacts as $contact) {
    //
}

Status

If you see something not planned, that you want, make an issue and there's a good chance I will add it., (*10)

  • [x] Blogs (COS) :new:
  • [x] Blog Authors (COS) :new:
  • [x] Blog Posts (COS) :new:
  • [x] Blog Topics (COS) :new:
  • [x] Companies :new:
  • [x] Company Properties :new:
  • [x] Contacts
  • [x] Contact Lists
  • [x] Contact Properties
  • [x] Deals :new:
  • [x] Email :new:
  • [x] Email Events :new:
  • [x] Engagements
  • [x] Events (Enterprise) :new:
  • [x] Files (COS) :new:
  • [x] Forms
  • [x] Keywords
  • [x] Owners
  • [x] Page Publishing (COS) :new:
  • [x] Social Media
  • [ ] Templates (COS) :new:
  • [x] Timeline :new:
  • [x] Workflows

The Versions

09/02 2018

dev-master

9999999-dev

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

09/02 2018

dev-daily-api-usage

dev-daily-api-usage

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

01/02 2018

dev-update-companies-batch

dev-update-companies-batch

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

17/01 2018

v1.1.2

1.1.2.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

16/10 2017

2.0.x-dev

2.0.9999999.9999999-dev

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

16/10 2017

v1.1.1

1.1.1.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

08/08 2017

v1.1.0

1.1.0.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

16/05 2017

v1.0.4

1.0.4.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

19/02 2017

v1.0.3

1.0.3.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

10/02 2017

v1.0.2

1.0.2.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

25/01 2017

v1.0.1

1.0.1.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

18/01 2017

v1.0.0

1.0.0.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

18/10 2016

v1.0.0-rc.4

1.0.0.0-RC4

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

12/10 2016

v1.0.0-rc.3

1.0.0.0-RC3

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

10/06 2016

v1.0.0-rc.2

1.0.0.0-RC2

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

03/06 2016

v1.0.0-rc.1

1.0.0.0-RC1

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

api hubspot

23/05 2016

v0.9.11

0.9.11.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

20/03 2016

v0.9.10

0.9.10.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

17/02 2016

dev-php54-guzzle5

dev-php54-guzzle5

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

28/12 2015

dev-php53

dev-php53

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

by Ryan Winchester (fungku)
by Stuart Fyfe

api hubspot

17/10 2015

dev-develop

dev-develop

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

16/10 2015

v0.9.9

0.9.9.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

29/05 2015

v0.9.8

0.9.8.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

20/04 2015

v0.9.7

0.9.7.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

19/04 2015

v0.9.6

0.9.6.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

14/04 2015

v0.9.5

0.9.5.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

31/03 2015

v0.9.4

0.9.4.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

25/03 2015

v0.9.3

0.9.3.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

24/03 2015

v0.9.2

0.9.2.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

16/03 2015

v0.9.1

0.9.1.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

16/03 2015

v0.9

0.9.0.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

16/03 2015

v0.2

0.2.0.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Ryan Winchester (fungku)

api hubspot

15/11 2014

v0.1.1

0.1.1.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

by Ryan Winchester (fungku)

15/11 2014

v0.1.0

0.1.0.0

HubSpot PHP API client

  Sources   Download

Apache-2.0

The Requires

 

by Ryan Winchester (fungku)