Download the PHP package tapp/laravel-hubspot without Composer
On this page you can find all versions of the php package tapp/laravel-hubspot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tapp/laravel-hubspot
More information about tapp/laravel-hubspot
Files in tapp/laravel-hubspot
Package laravel-hubspot
Short Description This is my package laravel-hubspot
License MIT
Homepage https://github.com/tappnetwork/laravel-hubspot
Informations about the package laravel-hubspot
Laravel HubSpot Integration
A Laravel package for seamless integration with HubSpot CRM. Provides automatic synchronization of Laravel models with HubSpot contacts and companies, with support for queued operations.
Installation
Configuration
Add your HubSpot API key to your .env file:
Usage
User Model Setup
Add the trait to your User model, implement the required interface, and define the HubSpot property mapping:
Interface Requirement
Important: Models must implement HubspotModelInterface to enable automatic synchronization. This interface ensures your models have the required methods for HubSpot integration:
getHubspotMap()- Returns the property mapping arraygetHubspotUpdateMap()- Returns update-specific property mappinggetHubspotCompanyRelation()- Returns the company relationship namegetHubspotProperties()- Returns dynamic propertiesgetHubspotId()/setHubspotId()- Manages the HubSpot ID
The traits (HubspotContact, HubspotCompany) provide the implementation for these methods, so you only need to implement the interface and define your $hubspotMap array.
Company Model Setup
For company models, use the HubspotCompany trait:
Dynamic Properties
Override getHubspotProperties() to add dynamic or computed properties. The hubspot:sync-properties command discovers property keys from your map, hubspotProperties(), and getHubspotProperties(), so you only need to override this method for your dynamic keys to be created in HubSpot.
When the model has no id (e.g. hubspot:sync-properties uses new User() to discover keys), return the same keys with null values so the command can build the full list without running user-specific queries.
If you need to customize the full property set (e.g. computed values that replace or extend map-based properties), you can instead override hubspotProperties() using trait aliasing: alias the trait method (e.g. hubspotProperties as traitHubspotProperties), call $this->traitHubspotProperties($map), merge your properties, and return.
Observers (Required for Automatic Sync)
Important: Observers are required for automatic synchronization. Register observers in your AppServiceProvider to enable automatic sync when models are created/updated:
Manual Sync (Alternative)
If you prefer manual control over when syncing occurs, you can use the provided commands instead of observers:
Note: Without observers, models will only sync when you explicitly run these commands.
Sync Properties
Create the property group and properties in HubSpot:
Queuing
The package supports queued operations for better performance. Configure in your .env:
Run queue workers:
Testing
Quick Start
Setup Integration Tests
-
Create
.env.testing: -
Get HubSpot test API key with scopes:
crm.objects.contacts.readcrm.objects.contacts.writecrm.objects.companies.readcrm.objects.companies.write
- Sync test properties:
Flexible Testing
Switch between mocked and real API calls:
Testing Documentation
- Quick Start Guide - Fast testing checklist
- Comprehensive Testing Guide - Detailed testing strategy
Upgrading
⚠️ Upgrading from a previous version? Please see the Upgrade Guide for breaking changes and migration instructions.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- [TappNetwork](https://github.com/Scott Grayson)
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-hubspot with dependencies
hubspot/api-client Version ^14.1
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
spatie/laravel-package-tools Version ^1.16