Segment.com wrapper for Laravel 5.
THIS PACKAGE IS NOW DEPRECATED. PLEASE LOOK AT ALTTHREE/SEGMENT
Add the following to your composer.json
file.
"require": {
"cachethq/segment": "~2.1"
}
Get the package installed.
$ composer update
Add the service provider to app.php
'providers' => [
// ...
'CachetHQ\Segment\SegmentServiceProvider',
],
If you want to use the Facade, also add the alias:
'aliases' => [
// ...
'Segment' => 'CachetHQ\Segment\Facades\Segment',
],
Install the configuration file.
$ php artisan vendor:publish
Update the new configuration file with your write_key
as provided by Segment.com
Once you've set your write_key
value in the configuration, you're ready to go! For the most part you can follow Segments own instructions however, you'll want to replace the Analytics
classname with Segment
- plus, you don't need to call class_alias
.
Segment::identify([
"userId" => "12345abcde",
"traits" => [
"name" => "James Brooks",
"email" => "test@test.com",
]
]);
Segment::track([
"userId" => "12345abcde",
"event" => "Did something",
"properties" => [
"was_awesome" => true,
]
]);
Laravel Segment is licensed under The MIT License (MIT).