cachethq/segment

This package is abandoned and no longer maintained. The author suggests using the alt-three/segment package instead.

Segment.com wrapper written for Laravel

2.1.2 2015-06-27 13:39 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT d2643d346f2dca470de9dccd90d178215203067b

  • James Brooks <james.woop@alt-three.com>
  • Graham Campbell <graham.woop@alt-three.com>
  • Joseph Cohen <joe.woop@alt-three.com>

frameworkapilaravelsegment.iosegmentsegment.comLaravel SegmentCachetHQcachetCachet HQ

This package is auto-updated.

Last update: 2022-02-01 12:48:52 UTC


README

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).