All Projects → HubSpot → Hubspot Php

HubSpot / Hubspot Php

Licence: other
HubSpot PHP API Client

Projects that are alternatives of or similar to Hubspot Php

Cv4pve Api Java
Proxmox VE Client API JAVA
Stars: ✭ 17 (-93.77%)
Mutual labels:  api, api-client, api-rest
Anyapi
AnyAPI is a library that helps you to write any API wrappers with ease and in pythonic way.
Stars: ✭ 126 (-53.85%)
Mutual labels:  api, api-client, api-wrapper
Slack
🎉✨ Slack API client for Node and browsers.
Stars: ✭ 903 (+230.77%)
Mutual labels:  api, api-client, api-wrapper
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+191.58%)
Mutual labels:  api, api-client, api-wrapper
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (-33.7%)
Mutual labels:  api, api-wrapper, api-rest
Hoppscotch
👽 Open source API development ecosystem https://hoppscotch.io
Stars: ✭ 34,569 (+12562.64%)
Mutual labels:  api, api-client, api-rest
Apipie
Transform api declaration to js object for frontend. Inspired by VueRouter, koa-middleware and axios.
Stars: ✭ 29 (-89.38%)
Mutual labels:  api, api-client, api-wrapper
Mobx Rest
REST conventions for Mobx
Stars: ✭ 164 (-39.93%)
Mutual labels:  api, api-client, api-rest
Js Client
A Open-API derived JS + Node.js API client for Netlify
Stars: ✭ 170 (-37.73%)
Mutual labels:  api, api-client, api-rest
Coingecko Api
A Node.js wrapper for the CoinGecko API with no dependencies.
Stars: ✭ 159 (-41.76%)
Mutual labels:  api, api-client, api-wrapper
Binance
A .NET Standard Binance API library.
Stars: ✭ 199 (-27.11%)
Mutual labels:  api, api-client, api-wrapper
Virustotal Api
Virus Total Public/Private/Intel API
Stars: ✭ 189 (-30.77%)
Mutual labels:  api, api-client, api-wrapper
Coinapi Sdk
SDKs for CoinAPI
Stars: ✭ 238 (-12.82%)
Mutual labels:  api, api-client, api-rest
clickupython
A client for working with the ClickUp API V2
Stars: ✭ 30 (-89.01%)
Mutual labels:  api-client, api-wrapper
zoho-crm-php
An API wrapper library for Zoho CRM, written in PHP.
Stars: ✭ 15 (-94.51%)
Mutual labels:  api-client, api-wrapper
AutoMeter-API
AutoMeter-API是一款针对分布式服务,微服务API功能和性能一体的自动化测试平台,一站式解决应用,服务,API,环境管理,用例,条件,测试场景,计划,测试报告,功能/性能测试兼容支持的一体化工作平台
Stars: ✭ 105 (-61.54%)
Mutual labels:  api-client, api-rest
ksoftapi.py
Official API Wrapper for KSoft.Si API
Stars: ✭ 31 (-88.64%)
Mutual labels:  api-client, api-wrapper
notionapi-agent
Unofficial Node.js API client for Notion.so
Stars: ✭ 89 (-67.4%)
Mutual labels:  api-client, api-wrapper
chess.com
Python wrapper for Chess.com Published-Data API
Stars: ✭ 34 (-87.55%)
Mutual labels:  api-client, api-rest
nyxx
Wrapper around Discord API for Dart
Stars: ✭ 217 (-20.51%)
Mutual labels:  api-client, api-wrapper

HubSpot PHP API client

Version Total Downloads Build Status License

Hubspot is a marketing, sales, and service software that helps your business grow without compromise. Because “good for the business” should also mean “good for the customer.”

Setup

Composer:

composer require "hubspot/hubspot-php"

Sample apps

Link

Quickstart

Examples Using Factory

All following examples assume this step.

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

// OR create with OAuth2 access token

$hubspot = SevenShores\Hubspot\Factory::createWithOAuth2Token('access-token');

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

$hubspot = new SevenShores\Hubspot\Factory([
  'key'      => 'demo',
  'oauth2'   => 'false', // default
]);

You can find more information about API keys here and about access tokens here

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::createWithOAuth2Token())

$hubspot = new SevenShores\Hubspot\Factory([
  'key'      => 'demo',
],
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.

API Client comes with Middleware for implementation of Rate and Concurrent Limiting.

It provides an ability to turn on retry for failed requests with statuses 429 or 500. You can read more about working within the HubSpot API rate limits here.

$handlerStack = \GuzzleHttp\HandlerStack::create();
$handlerStack->push(
    \SevenShores\Hubspot\RetryMiddlewareFactory::createRateLimitMiddleware(
        \SevenShores\Hubspot\Delay::getConstantDelayFunction()
    )
);

$handlerStack->push(
    \SevenShores\Hubspot\RetryMiddlewareFactory::createInternalErrorsMiddleware(
        \SevenShores\Hubspot\Delay::getExponentialDelayFunction(2)
    )
);

$guzzleClient = new \GuzzleHttp\Client(['handler' => $handlerStack]);

$config = [
    'key'      => 'demo',
    'oauth2'   => false,
];

$hubspot = new \SevenShores\Hubspot\Factory($config, new \SevenShores\Hubspot\Http\Client($config, $guzzleClient));

Get a single contact:

$contact = $hubspot->contacts()->getByEmail("[email protected]");

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!

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?

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

$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) {
    //
}

Example of using built in utils

<?php

require 'vendor/autoload.php';

use SevenShores\Hubspot\Utils\OAuth2;

$authUrl = OAuth2::getAuthUrl(
    'clientId',
    'http://localhost/callaback.php',
    'contacts'
);

or using Factory:

<?php

require 'vendor/autoload.php';

use SevenShores\Hubspot\Utils;

$authUrl = Utils::getFactory()->oAuth2()->getAuthUrl(
    'clientId',
    'http://localhost/callaback.php',
    'contacts'
);

Status

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

  • [x] Analytics API
  • [x] Calendar API :upadated:
  • [x] Companies API :upadated:
  • [x] Company Properties API :upadated:
  • [x] Contacts API :upadated:
  • [x] Contact Lists API :upadated:
  • [x] Contact Properties API :upadated:
  • [ ] Conversations Live Chat Widget API (Front End)
  • [x] CMS Blog API (Blogs) :upadated:
  • [x] CMS Blog Authors API (BlogAuthors) :upadated:
  • [x] CMS Blog Comments API (BlogComments)
  • [x] CMS Blog Post API (BlogPosts)
  • [x] CMS Blog Topics API (BlogTopics)
  • [ ] CMS Domains API
  • [x] CMS Files API (Files)
  • [x] CMS HubDB API (HubDB) :upadated:
  • [ ] CMS Layouts API
  • [x] CMS Page Publishing API (Pages)
  • [ ] CMS Site Maps
  • [ ] CMS Site Search API
  • [ ] CMS Templates API
  • [ ] CMS URL Mappings API
  • [x] CRM Associations API
  • [ ] CRM Extensions API
  • [x] CRM Object Properties API (ObjectProperties) 🆕
  • [x] CRM Pipelines API (CrmPipelines)
  • [x] Deals API
  • [x] Deal Pipelines API :deprecated:
  • [x] Deal Properties API :upadated:
  • [x] Ecommerce Bridge API :upadated:
  • [x] Email Subscription API :upadated:
  • [x] Email Events API :upadated:
  • [x] Engagements API
  • [x] Events API
  • [x] Forms API :upadated:
  • [x] Line Items API 🆕
  • [ ] Marketing Email API
  • [x] Owners API :upadated:
  • [x] Products API 🆕
  • [x] Social Media API
  • [x] Tickets API
  • [x] Timeline API :upadated:
  • [ ] Tracking Code API
  • [x] Transactional Email API
  • [x] Workflows API :upadated:
  • [x] Webhooks API
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].