Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.

GrahamDeprecated/Laravel-Segment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

[DEPRECATED] Segment.com wrapper for Laravel 5

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages