8000 GitHub - AltThree/Segment at v3.3.0
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

AltThree/Segment

Repository files navigation

Alt Three Segment

Build Status StyleCI License

A Segment bridge for Laravel 5.

Installation

This version requires PHP 7.1-7.3, and supports Laravel 5.5-5.8 and 6 only.

To get the latest version, simply require the project using Composer:

$ composer require alt-three/segment

Once installed, if you are not using automatic package discovery, then you need to register the AltThree\Segment\SegmentServiceProvider service provider in your config/app.php.

Configuration

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/segment.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.

Usage

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,
    ]
]);

Security

Our full security policy is available to read here.

License

Alt Three Segment is licensed under The MIT License (MIT).

0