New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

binarcode/laravel-segment

A Laravel wrapper for the Segment API and events tracking.
201,992 7
Install
composer require binarcode/laravel-segment
Latest Version:1.0.0
PHP:^8.0|^8.1
Laravel:10 – 13
Older releases:9
License:MIT
Last Updated:Oct 23, 2023
Links: GitHub  ·  Packagist
Maintainer: binaryk

A Laravel wrapper for the Segment API and events tracking.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Segment simplifies the process of collecting data and connecting new tools, allowing you to spend more time using your data, and less time trying to collect it. You can use Segment to track events that happen when a user interacts with the interfaces. “Interfaces” is Segment’s generic word for any digital properties you own: your website, mobile apps, and processes that run on a server or OTT device.

Official documentation

Installation

You can install the package via composer:

composer require binarcode/laravel-segment

You can publish and run the migrations with:

php artisan vendor:publish --tag="segment-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="segment-config"

This is the contents of the published config file:

return [
    /**
     * The queue name where the segment events will be dispatched.
     */
    'queue' => env('SEGMENT_QUEUE', env('QUEUE_CONNECTION', 'sync')),

    /**
     * Segment API key [see: https://segment.com/docs/connections/sources/catalog/libraries/server/php/#identify].
     */
    'key' => env('SEGMENT_KEY', ''),
];

Usage

Track event

BinarCode\LaravelSegment\Facades\LaravelSegment::track('click')->properties([...])

Alias anonymous id to a real user id

BinarCode\LaravelSegment\Facades\LaravelSegment::alias($previous, $userId);

The Segment Identify

BinarCode\LaravelSegment\Facades\LaravelSegment::identify($userId, $data);

The Segment Identify call lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about the user, like their email, name, and more.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

slashequip/laravel-segment

Laravel Segment is an opinionated, approach to integrating Segment into your Lar...

102,065 25
daanra/laravel-segment

Laravel Segment is an opinionated, approach to integrating Segment into your Lar...

8,740 0
binarcode/laravel-developer

Lightweight package to log slack exceptions.

365,508 10
binarcode/laravel-mailator

Laravel email scheduler

316,405 251
binarcode/nova-chat

A realtime chat implementation for laravel nova.

1,812 15

Version History

Version Released PHP Laravel License
1.0.0 ^8.0|^8.1 MIT
0.5.0 ^8.0 ^9.0 MIT
0.0.4 ^8.0 ^9.0 MIT
0.0.3 ^8.0 ^9.0 MIT
0.0.2 ^8.0 ^9.0 MIT