PHPackages                             burnthebook/craft-commerce-hubspot-integration - 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. burnthebook/craft-commerce-hubspot-integration

ActiveCraft-plugin[API Development](/categories/api)

burnthebook/craft-commerce-hubspot-integration
==============================================

Integrates Craft Commerce with Hubspot

0.0.7(1mo ago)134mitPHPPHP &gt;=8.2

Since Mar 13Pushed 2mo agoCompare

[ Source](https://github.com/Burnthebook/craft-commerce-hubspot-integration)[ Packagist](https://packagist.org/packages/burnthebook/craft-commerce-hubspot-integration)[ RSS](/packages/burnthebook-craft-commerce-hubspot-integration/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (15)Versions (8)Used By (0)

Craft Commerce Hubspot Integration
==================================

[](#craft-commerce-hubspot-integration)

Integrates Craft Commerce with Hubspot.

Warning

This plugin is built for burnthebook internal use currently. Not a lot is generally configurable, and it is specific to our clients workflows. Eventually we would like to make this generic enough that anyone could use it, hence it's existence as a public repository. You can also use the code as a reference to create your own.

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

[](#requirements)

- Craft CMS 5.0.0+
- PHP 8.3+

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

[](#installation)

```
# Go to your Craft project
cd /path/to/project

# Install the plugin
composer require burnthebook/craft-commerce-hubspot-integration

# Enable the plugin
php craft plugin/install craft-commerce-hubspot-integration
```

Setup
-----

[](#setup)

Go to Admin -&gt; Settings -&gt; Craft Commerce Hubspot Integration, configure your Hubspot API Base URL (default ) and HubSpot Private App Token (It is recommended to use an .env variable for this).

Order Sync Lifecycle
--------------------

[](#order-sync-lifecycle)

When an order completes, sync is queued and executed in staged jobs. The flow below references the concrete classes in this plugin.

### Runtime wiring

[](#runtime-wiring)

- Plugin bootstrap: `src/CommerceHubspotIntegration.php`
- Event attachment: `CommerceHubspotIntegration::attachEventHandlers()`
- Queue entrypoint: `src/jobs/HubspotOrderSyncJob.php`
- Orchestration service: `src/services/HubspotApiService.php`
- Low-level API client: `src/services/HubspotApiClient.php`
- Stage handlers:
    - `src/services/handlers/HubspotContactsCompaniesHandler.php`
    - `src/services/handlers/HubspotCourseHandler.php`
    - `src/services/handlers/HubspotOrderHandler.php`
    - `src/services/handlers/HubspotAssociationHandler.php`

### End-to-end order flow

[](#end-to-end-order-flow)

1. `craft\commerce\elements\Order::EVENT_AFTER_COMPLETE_ORDER` fires.
2. `CommerceHubspotIntegration::attachEventHandlers()` enqueues `HubspotOrderSyncJob` with `orderId`.
3. `HubspotOrderSyncJob::execute()`:
    - loads/creates `HubspotSyncRecord` (`src/records/HubspotSyncRecord.php`),
    - computes payload hash from `Order::toArray()`,
    - skips if previously `succeeded` with identical hash,
    - marks `in_progress`, then queues stage 1 (`HubspotContactsCompaniesSyncJob`).
4. `HubspotContactsCompaniesSyncJob::execute()`:
    - resolves order,
    - calls `HubspotApiService::syncOrderContactsAndCompanies()`,
    - queues stage 2 (`HubspotCoursesSyncJob`) with returned contact/company context.
5. `HubspotCoursesSyncJob::execute()`:
    - calls `HubspotApiService::syncOrderCourses()`,
    - queues stage 3 (`HubspotOrderRecordSyncJob`) with `courseMap`.
6. `HubspotOrderRecordSyncJob::execute()`:
    - calls `HubspotApiService::syncOrderRecord()`,
    - queues stage 4 (`HubspotAssociationsSyncJob`) with `hubspotOrderId`.
7. `HubspotAssociationsSyncJob::execute()`:
    - calls `HubspotApiService::syncOrderAssociations()`,
    - marks sync record `succeeded` and sets `syncedAt`.

### Failure and retry behavior

[](#failure-and-retry-behavior)

- Stage jobs extend `AbstractHubspotSyncStageJob` (`src/jobs/AbstractHubspotSyncStageJob.php`).
- On exception, `AbstractHubspotSyncStageJob::markFailed()` updates sync record status to `failed`, stores error text, and stores HubSpot correlation ID when available.
- Queue retry behavior is implemented via `RetryableJobInterface` (`canRetry()` / `getTtr()`).

### Auth and settings resolution

[](#auth-and-settings-resolution)

- Plugin settings model: `src/models/Settings.php`.
- Service components are built in `CommerceHubspotIntegration::config()`.
- Env vars are resolved via `craft\helpers\App::parseEnv(...)` before building `HubspotApiClient`.
- API client sends Bearer auth (`Authorization: Bearer `) and applies retry/backoff for `429` and `5xx` responses.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance89

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~12 days

Recently: every ~18 days

Total

7

Last Release

30d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/59731094?v=4)[Burnthebook Ltd.](/maintainers/burnthebook)[@Burnthebook](https://github.com/Burnthebook)

---

Top Contributors

[![MadMikeyB](https://avatars.githubusercontent.com/u/831828?v=4)](https://github.com/MadMikeyB "MadMikeyB (13 commits)")

### Embed Badge

![Health badge](/badges/burnthebook-craft-commerce-hubspot-integration/health.svg)

```
[![Health](https://phpackages.com/badges/burnthebook-craft-commerce-hubspot-integration/health.svg)](https://phpackages.com/packages/burnthebook-craft-commerce-hubspot-integration)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.3M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1772.4k4](/packages/aimeos-prisma)

PHPackages © 2026

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