A Segment bridge for Laravel 5.
This version requires PHP 7, and supports Laravel 5.1, 5.2, 5.3, 5.4, or 5.5.
To get the latest version, simply require the project using Composer:
$ composer require alt-three/segment
Once installed, you need to register the AltThree\Segment\SegmentServiceProvider
service provider in your config/app.php
, or if you're using Laravel 5.5, this can be done via the automatic package discovery.
Alt Three Segment requires configuration.
To get started, you'll need to publish all vendor assets:
$ php artisan vendor:publish
This will create a config/segement.php
file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.
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" => "[email protected]",
]
]);
Segment::track([
"userId" => "12345abcde",
"event" => "Did something",
"properties" => [
"was_awesome" => true,
]
]);
If you discover a security vulnerability within this package, please e-mail us at [email protected]. All security vulnerabilities will be promptly addressed.
Alt Three Segment is licensed under The MIT License (MIT).