This library adapts the Vero PHP library for Laravel. It provides a service container and facade for easy access.
- PHP 7.1+
- Laravel 5.6+
- json extension // Undocumented requirement of the underlying library
- curl extension // Undocumented requirement of the underlying library
- Install the library with composer
composer require samlittler/laravel-vero
- Store an auth_token key in your
config/services.php
return [
...
'vero' => [
'auth_token' => env('VERO_AUTH_TOKEN'),
],
];
- Lastly, add your Vero auth token to your
.env
VERO_AUTH_TOKEN="your auth token here"
- Users
- Identify
- Unsubscribe
- Resubscribe
- Delete
- Tags
- Add
- Remove
- Events
- Track
$vero = new \SamLittler\Vero('<your_auth_token>');
Standard Identify Usage
Standard identification usage is simple, and it allows subsequent track events to be collected on the Vero dashboard.
$user = Vero::users()->findOrCreate(123);
$user->identify();
You can also add arbitrary identification information here.
Note: Email addresses have a dedicated method, because they're handled differently.
$user = Vero::users()->findOrCreate(123);
$user->setEmail('[email protected]');
$user->identify([
'forename' => 'John',
'surname' => 'Smith',
]);
Push Channels
You can only register push channels during the identify call.
$user = Vero::users()->findOrCreate(123);
$user->addChannel('push', '<apns_or_fcm_token>', 'ios');
$user->identify();
You can programmatically unsubscribe users from Vero marketing.
$user = Vero::users()->findOrCreate(123);
$user->unsubscribe();
You can programmatically resubscribe users to Vero marketing.
$user = Vero::users()->findOrCreate(123);
$user->unsubscribe();
You can delete users from Vero. You'll require a new identify call to re-add them.
$user = Vero::users()->findOrCreate(123);
$user->delete();
$user = Vero::users()->findOrCreate(123);
$user->addTag('november');
$user = Vero::users()->findOrCreate(123);
$user->removeTag('november');
You can send track events with arbitrary data.
$user = Vero::users()->findOrCreate(123);
$user->track('User Registered', [
'referral' => 'app_store',
]);