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.
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.
Composer:
"require": {
"fungku/hubspot-php": "~0.9@dev"
}
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');
$contact = $hubspot->contacts()->getByEmail("test@hubspot.com");
// 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'];
$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'];
}
(: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)