Skip to content

TappNetwork/Laravel-Hubspot

Repository files navigation

This is my package laravel-hubspot

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require tappnetwork/laravel-hubspot

You can publish and run the migrations with:

php artisan vendor:publish --tag="hubspot-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="laravel-hubspot-config"

This is the contents of the published config file:

return [
    'api_key' => env('HUBSPOT_TOKEN'),
    'log_requests' => env('HUBSPOT_LOG_REQUESTS', true),
    'property_group' => env('HUBSPOT_PROPERTY_GROUP', 'app_user_profile'),
    'property_group_label' => env('HUBSPOT_PROPERTY_GROUP_LABEL', 'App User Profile'),
];

Usage

API Key

Publish the config, add your api key to the env

User Model

Add the trait to your user model and define any fields to the $hubspotMap property that will determine the data sent to HubSpot. You may use dot notation to access data from relations. For further customization, use Laravel's accessor pattern

use Tapp\LaravelHubspot\Models\HubspotContact;

class User extends Authenticatable 
{
    use HubspotContact; 

    public array $hubspotMap = [
        'email' => 'email',
        'first_name' => 'first_name',
        'last_name' => 'last_name',
        'user_type' => 'type.name',
    ];

Create HubSpot Properties

run the following command to create the property group and properties.

php artisan hubspot:sync-properties

Sync to HubSpot

The package uses model events to create or update contacts in HubSpot. Try registering a user and see that they have been created in HubSpot with properties from the $hubspotMap array.

Testing

composer test

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

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages