1. Go to this page and download the library: Download trigger-engage/laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
trigger-engage / laravel example snippets
use TriggerEngage\Laravel\Facades\TriggerEngage;
// Upsert a person profile (who messages get sent to)
TriggerEngage::identify('user-42', [
'email' => $user->email,
'first_name' => $user->first_name,
'phone' => $user->phone,
'type' => 'user',
]);
// Merge typed profile properties (numbers, booleans, strings, arrays, or objects)
TriggerEngage::setProperties('user-42', [
'appointments' => 4,
'plan' => 'wellness',
'active' => true,
]);
// Track an event — this is what triggers automations
TriggerEngage::event('customer_sign_up', ['plan' => 'free'], person: 'user-42');
// Add/remove a person to a MANUAL segment (event-driven and rule-based
// segments manage their own membership and are not changed from the SDK)
TriggerEngage::addToSegment('seg_01...', 'user-42');
TriggerEngage::removeFromSegment('seg_01...', 'user-42');
// Before signup — an anonymous event keyed by a device/session id
TriggerEngage::event('pricing_view', ['path' => '/pricing'], anonymousId: 'device-abc');
// On signup — folds the anonymous profile (events, attributes, memberships) into user-42
TriggerEngage::identify('user-42', ['email' => $user->email], anonymousId: 'device-abc');
$fake = TriggerEngage::fake();
// ... run the code under test ...
$fake->assertEventSent('customer_sign_up', fn ($data, $person) => $person === 'user-42');
$fake->assertIdentified('user-42');
$fake->assertEventSentTimes('customer_sign_up', 1);
$fake->assertEventNotSent('wallet_funded');
$fake->assertNothingSent();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.