/hubspot-php

HubSpot PHP API Client

Primary LanguagePHPOtherNOASSERTION

HubSpot PHP API client

Version Total Downloads License Scrutinizer Code Quality Build Status

A new HubSpot API client. The sequel to my perfectly functional wrapper of HubSpot/haPihP. client. However, this includes some of the new COS/v2 endpoints.

BETA

Please try it out, and let me know if things are working as expected.

DOCS

Setup

Composer:

"require": {
	"fungku/hubspot-php": "~0.9@dev"
}

Quickstart

Instantiate hubspot service

All following examples assume this step.

Note: The Hubspot class checks for a HUBSPOT_API_KEY environment variable if you don't include one during instantiation.

$hubspot = Fungku\HubSpot\HubSpotService::make('api-key');

Get a single contact:

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

Paginate through all contacts:

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

foreach ($collection['contacts'] as $contact) {
    echo $contact['properties']['firstname']['value'];
}

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

Get a group of contacts by Ids

$vids = [196189, 196188, 196187];

// Get batch of contacts, and limit properties to firstname
$contacts = $hubspot->contacts()->getBatchByIds($vids, ['property' => 'firstname']);

foreach ($contacts as $contact) {
    echo $contact['properties']['firstname']['value'];
}

Status

(:ballot_box_with_check: Complete, :wavy_dash: In Progress, :white_medium_small_square: Todo, :black_medium_small_square: Not planned)

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

:ballot_box_with_check: Blog (COS) :new:

:ballot_box_with_check: Blog Posts (COS) :new:

☑️ Contacts

☑️ Contact Lists

☑️ Contact Properties

:ballot_box_with_check: Email :new:

:ballot_box_with_check: Email Events :new:

:ballot_box_with_check: Files (COS) :new:

☑️ Forms

☑️ Keywords

:ballot_box_with_check: Page Publishing (COS) :new:

☑️ Social Media

☑️ Workflows

◾ Blog (CMS)

:black_medium_small_square: Companies :new:

:black_medium_small_square: Companies Properties :new:

:black_medium_small_square: Deals :new:

◾ MarketPlace

◾ Settings