PHPackages                             ibrhaim13/api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ibrhaim13/api-client

ActiveLibrary[API Development](/categories/api)

ibrhaim13/api-client
====================

This fork of (Hubspot API client/official package) to be compatible with php 7.1 or above with some customize

v2.3(3y ago)0147MITPHPPHP &gt;=7.1

Since Dec 14Pushed 3y agoCompare

[ Source](https://github.com/ibrhaim13/hubspot-api-php)[ Packagist](https://packagist.org/packages/ibrhaim13/api-client)[ Docs](https://github.com/ibrhaim13/hubspot-api-php)[ RSS](/packages/ibrhaim13-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (6)Used By (0)

hubspot-api-php
===============

[](#hubspot-api-php)

[![Latest Packagist Version](https://camo.githubusercontent.com/dd7456a5a1dff185675238981dce7fa3d64ee7390a96a55df31ce875af7af481/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68756273706f742f6170692d636c69656e743f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://packagist.org/packages/hubspot/api-client)[![Total Downloads](https://camo.githubusercontent.com/2ca78a7509e375bd87aa4b022ebff5804510929b5082f4c6e6ef7bb6d78f5355/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68756273706f742f6170692d636c69656e742e7376673f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://packagist.org/packages/hubspot/api-client)

PHP [HubSpot API](https://developers.hubspot.com/docs/api/overview) v3 SDK(Client) files

Installation
------------

[](#installation)

```
composer require hubspot/api-client
```

Requirements
------------

[](#requirements)

The current package requirements are:

PHP &gt;= 7.3

### Sample apps

[](#sample-apps)

Please, take a look at our [Sample apps](https://github.com/HubSpot/sample-apps-list)

Quickstart
----------

[](#quickstart)

#### To instantiate API Client using access token use Factory:

[](#to-instantiate-api-client-using-access-token-use-factory)

```
$hubspot = \HubSpot\Factory::createWithAccessToken('access-token');
```

You'll need to create a [private app](https://developers.hubspot.com/docs/api/private-apps) to get your access token or you can obtain [OAuth2](https://developers.hubspot.com/docs/api/working-with-oauth) access token.

#### To instantiate API Client using developer apikey use Factory:

[](#to-instantiate-api-client-using-developer-apikey-use-factory)

```
$hubspot = \HubSpot\Factory::createWithDeveloperApiKey('developer-apikey');
```

#### also you can pass custom client to Factory:

[](#also-you-can-pass-custom-client-to-factory)

```
$client = new \GuzzleHttp\Client([...]);

$hubspot = \HubSpot\Factory::createWithAccessToken('access-token', $client);
```

#### To change the base path:

[](#to-change-the-base-path)

```
$config = new \GuzzleHttp\Config();
$config->setBasePath('*');
$config->setAccessToken('*');
$config->setDeveloperApiKey('*');

$hubspot = \HubSpot\Factory::create(null, $config);
```

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

[](#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. Please note that Apps using OAuth are only subject to a limit of 100 requests every 10 seconds.

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

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

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

$hubspot = \HubSpot\Factory::createWithAccessToken('access-token', $client);
```

#### Get contacts page:

[](#get-contacts-page)

```
$response = $hubspot->crm()->contacts()->basicApi()->getPage();
```

#### Search for a contact:

[](#search-for-a-contact)

```
$filter = new \HubSpot\Client\Crm\Contacts\Model\Filter();
$filter
    ->setOperator('EQ')
    ->setPropertyName('email')
    ->setValue($search);

$filterGroup = new \HubSpot\Client\Crm\Contacts\Model\FilterGroup();
$filterGroup->setFilters([$filter]);

$searchRequest = new \HubSpot\Client\Crm\Contacts\Model\PublicObjectSearchRequest();
$searchRequest->setFilterGroups([$filterGroup]);

// Get specific properties
$searchRequest->setProperties(['firstname', 'lastname', 'date_of_birth', 'email']);

// @var CollectionResponseWithTotalSimplePublicObject $contactsPage
$contactsPage = $hubspot->crm()->contacts()->searchApi()->doSearch($searchRequest);
```

#### Create a contact:

[](#create-a-contact)

```
$contactInput = new \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput();
$contactInput->setProperties([
    'email' => 'example@example.com'
]);

$contact = $hubspot->crm()->contacts()->basicApi()->create($contactInput);
```

#### Update a contact:

[](#update-a-contact)

```
$newProperties = new \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput();
$newProperties->setProperties([
    'email' => 'updatedExample@example.com'
]);

$hubspot->crm()->contacts()->basicApi()->update($contactId, $newProperties);
```

#### Archive a contact:

[](#archive-a-contact)

```
$hubspot->crm()->contacts()->basicApi()->archive($contactId);
```

#### Get custom objects page:

[](#get-custom-objects-page)

```
$hubspot->crm()->objects()->basicApi()->getPage(HubSpot\Crm\ObjectType::CONTACTS)
```

#### File uploading

[](#file-uploading)

```
$file = new \SplFileObject('file path');
$response = $hubspot->files()->filesApi()->upload($file, null, '/', null, null, json_encode([
    'access' => 'PRIVATE',
    'ttl' => 'P2W',
    'overwrite' => false,
    'duplicateValidationStrategy' => 'NONE',
    'duplicateValidationScope' => 'EXACT_FOLDER'
]) );
```

#### Not wrapped endpoint(s)

[](#not-wrapped-endpoints)

It is possible to access the hubspot request method directly, it could be handy if client doesn't have implementation for some endpoint yet. Exposed request method benefits by having all configured client params.

```
$response = $hubspot->apiRequest([
    'method' => 'PUT',
    'path' => '/some/api/not/wrapped/yet',
    'body' => ['key' => 'value'],
]);
```

#### apiRequest options

[](#apirequest-options)

```
[
    'method' => string, // Http method (e.g.: GET, POST, etc). Default value GET
    'path' => string, // URL path (e.g.: '/crm/v3/objects/contacts'). Optional
    'headers' => array, // Http headers. Optional.
    'body' => mixed, // Request body (if defaultJson set body will be transforted to json string).Optional.
    'authType' => enum(none, accessToken, hapikey), // Auth type. if it isn't set it will use accessToken or hapikey. Default value is non empty auth type.
    'baseUrl' => string, // Base URL. Default value 'https://api.hubapi.com'.
    'qs' => array, // Query parameters. Optional.
    'defaultJson' => bool, // Default Json. if it is set to true it add to headers [ 'Content-Type' => 'application/json', 'Accept' => 'application/json, */*;q=0.8',]
    // and transfort body to json string. Default value true
];
```

#### get contacts

[](#get-contacts)

```
$response = $hubspot->apiRequest([
    'path' => '/crm/v3/objects/contacts',
]);
```

Contributing
------------

[](#contributing)

### Run spec tests

[](#run-spec-tests)

```
vendor/bin/phpspec run

```

### Run unit tests

[](#run-unit-tests)

```
vendor/bin/phpunit ./tests

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Total

4

Last Release

1214d ago

Major Versions

1.22.x-dev → v2.12022-12-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ec6d35b88d023aefb953853deeb40e6da9df55c3c617c73667b4423557ce2c0?d=identicon)[ibrhaim13](/maintainers/ibrhaim13)

---

Top Contributors

[![ksvirkou-hubspot](https://avatars.githubusercontent.com/u/57258237?v=4)](https://github.com/ksvirkou-hubspot "ksvirkou-hubspot (745 commits)")[![atanasiuk-hubspot](https://avatars.githubusercontent.com/u/57258334?v=4)](https://github.com/atanasiuk-hubspot "atanasiuk-hubspot (168 commits)")[![ibrahimMH13](https://avatars.githubusercontent.com/u/9980742?v=4)](https://github.com/ibrahimMH13 "ibrahimMH13 (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![mattdfloyd](https://avatars.githubusercontent.com/u/185187?v=4)](https://github.com/mattdfloyd "mattdfloyd (1 commits)")[![Rattone](https://avatars.githubusercontent.com/u/7362607?v=4)](https://github.com/Rattone "Rattone (1 commits)")[![taras-by](https://avatars.githubusercontent.com/u/15653428?v=4)](https://github.com/taras-by "taras-by (1 commits)")[![ArthurGuy](https://avatars.githubusercontent.com/u/92837?v=4)](https://github.com/ArthurGuy "ArthurGuy (1 commits)")[![yfaktor](https://avatars.githubusercontent.com/u/1022084?v=4)](https://github.com/yfaktor "yfaktor (1 commits)")[![asilverstein](https://avatars.githubusercontent.com/u/440978?v=4)](https://github.com/asilverstein "asilverstein (1 commits)")[![d3v1](https://avatars.githubusercontent.com/u/12612442?v=4)](https://github.com/d3v1 "d3v1 (1 commits)")

---

Tags

phpapisdkswaggerhubspotibrhaim13ibrahim

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/ibrhaim13-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/ibrhaim13-api-client/health.svg)](https://phpackages.com/packages/ibrhaim13-api-client)
```

###  Alternatives

[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)[mailchimp/marketing

1647.3M23](/packages/mailchimp-marketing)[php-opencloud/openstack

PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi

2292.2M24](/packages/php-opencloud-openstack)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[clever/clever-php

231.6k](/packages/clever-clever-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
