felixmaier1989/hubspot-php
Composer 安装命令:
composer require felixmaier1989/hubspot-php
包简介
HubSpot PHP API client
README 文档
README
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.
Setup
Composer:
composer require "ryanwinchester/hubspot-php:~1.0"
Quickstart
Examples Using Factory
All following examples assume this step.
$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())
$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.
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!
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) { // }
Status
If you see something not planned, that you want, make an issue and there's a good chance I will add it.
- Blogs (COS) 🆕
- Blog Authors (COS) 🆕
- Blog Posts (COS) 🆕
- Blog Topics (COS) 🆕
- Companies 🆕
- Company Properties 🆕
- Contacts
- Contact Lists
- Contact Properties
- Deals 🆕
- Email 🆕
- Email Events 🆕
- Engagements
- Events (Enterprise) 🆕
- Files (COS) 🆕
- Forms
- Keywords
- Owners
- Page Publishing (COS) 🆕
- Social Media
- Templates (COS) 🆕
- Timeline 🆕
- Workflows
felixmaier1989/hubspot-php 适用场景与选型建议
felixmaier1989/hubspot-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.17k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 02 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「hubspot」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 felixmaier1989/hubspot-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 felixmaier1989/hubspot-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 felixmaier1989/hubspot-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HubSpot OAuth 2.0 Client Provider for The PHP League OAuth2-Client
HubSpot RESTful API Resource Scaffolding.
HubSpot integration for Craft CMS
Expose Hubspot API features in Twig and pull in content from your HubSpot Portal.
Import HubSpot blog posts into WordPress.
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 24.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-02-01