Skip to content

albertsarle/hubspot-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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. There may still be a few small breaking changes here and there, so it is not recommended to use this in production unless you really know what you're doing.

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,
        'property'  => ['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.

☑️ Blog (COS) 🆕

☑️ Blog Posts (COS) 🆕

☑️ Contacts

☑️ Contact Lists

☑️ Contact Properties

☑️ Email 🆕

☑️ Email Events 🆕

☑️ Files (COS) 🆕

☑️ Forms

☑️ Keywords

☑️ Page Publishing (COS) 🆕

☑️ Social Media

☑️ Workflows

◽ Companies 🆕

◽ Companies Properties 🆕

◽ Deals 🆕

◾ MarketPlace

◾ Settings

◾ Blog (CMS)

SensioLabsInsight

About

HubSpot PHP API Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%