Skip to content
[DEPRECATED] Segment.com wrapper for Laravel 5
Branch: master
Clone or download
Latest commit a50526f Dec 30, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Updated copyright headers Jun 27, 2015
src Updated copyright headers Jun 27, 2015
tests Composer file and start work on SegmentServiceProvider Jan 23, 2015
.gitattributes Updated excluded files May 26, 2015
.gitignore Updated .gitignore May 26, 2015
.travis.yml Updated travis config May 26, 2015
LICENSE Updated copyright headers Jun 27, 2015
README.md Update README Dec 29, 2015
composer.json Use dist install by default Jun 25, 2015
phpunit.xml.dist Removed old config Jun 24, 2015

README.md

Laravel Segment

Segment.com wrapper for Laravel 5.

THIS PACKAGE IS NOW DEPRECATED. PLEASE LOOK AT ALTTHREE/SEGMENT

Installation

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

Using Laravel Segment

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.

Identify the user

Segment::identify([
    "userId" => "12345abcde",
    "traits" => [
        "name"  => "James Brooks",
        "email" => "test@test.com",
    ]
]);

Track actions

Segment::track([
    "userId"     => "12345abcde",
    "event"      => "Did something",
    "properties" => [
        "was_awesome" => true,
    ]
]);

License

Laravel Segment is licensed under The MIT License (MIT).

You can’t perform that action at this time.