cleyverson / brevo-engage
Provider-agnostic customer engagement and marketing automation for Laravel.
Requires
- php: ^8.2
- illuminate/contracts: ^10.0|^11.0|^12.0
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
- mautic/api-library: ^4.0
- sarfrazrizwan/laravel-brevo: ^1.0
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.5|^11.0
README
Provider-agnostic customer engagement and marketing automation for Laravel 10, 11, and 12.
Applications call Cleyverson\Engage\Facades\Engage; provider adapters own provider-specific code, so integrations such as Brevo, Mautic, Customer.io, Dittofeed, HubSpot, or Mailchimp can be added without changing application code.
Installation
composer require cleyverson/engage composer require sarfrazrizwan/laravel-brevo mautic/api-library php artisan vendor:publish --tag=engage-config php artisan vendor:publish --tag=engage-migrations php artisan migrate
Configuration
Brevo remains the default provider for backward compatibility:
ENGAGE_PROVIDER=brevo
To use Mautic:
ENGAGE_PROVIDER=mautic MAUTIC_BASE_URL= MAUTIC_USERNAME= MAUTIC_PASSWORD=
Published configuration:
return [ 'provider' => env('ENGAGE_PROVIDER', 'brevo'), 'environment' => env('ENGAGE_ENVIRONMENT'), 'queue' => true, 'track_events' => true, 'sync_contacts' => true, 'templates' => [ 'welcome' => 12, ], 'lists' => [ 'premium-users' => 42, ], 'mautic' => [ 'base_url' => env('MAUTIC_BASE_URL'), 'username' => env('MAUTIC_USERNAME'), 'password' => env('MAUTIC_PASSWORD'), ], ];
Usage
use Cleyverson\Engage\Facades\Engage; Engage::identify($user); Engage::identify($user, [ 'project' => 'WalletUP', 'language' => 'en', ]); Engage::track('login', $user); Engage::track('login', $user, [ 'device' => 'mobile', ]); Engage::addTag('premium', $user); Engage::removeTag('premium', $user); Engage::addToSegment('WalletUP', $user); Engage::removeFromSegment('WalletUP', $user);
Existing Brevo list and email helpers continue to work:
Engage::sendTemplate('welcome', $user, [ 'first_name' => $user->name, ]); Engage::addToList('premium-users', $user); Engage::removeFromList('premium-users', $user);
All outbound provider communication is performed by queued jobs. Events are always persisted in the engagement_events table before provider delivery; Mautic records stay in that table because Mautic does not expose a Brevo-equivalent custom event API.