PHPackages                             binarcode/laravel-segment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. binarcode/laravel-segment

ActiveLibrary[API Development](/categories/api)

binarcode/laravel-segment
=========================

A Laravel wrapper for the Segment API and events tracking.

1.0.0(3y ago)7193.9k↓24.2%3[2 PRs](https://github.com/BinarCode/laravel-segment/pulls)MITPHPPHP ^8.0|^8.1

Since Mar 9Pushed 2y ago3 watchersCompare

[ Source](https://github.com/BinarCode/laravel-segment)[ Packagist](https://packagist.org/packages/binarcode/laravel-segment)[ Docs](https://github.com/binarcode/laravel-segment)[ GitHub Sponsors](https://github.com/binarcode)[ RSS](/packages/binarcode-laravel-segment/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (13)Versions (11)Used By (0)

A Laravel wrapper for the Segment API and events tracking.
==========================================================

[](#a-laravel-wrapper-for-the-segment-api-and-events-tracking)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d0374c497e2e82f52fe6dcd655507c637ea92474281c66bf2994aa82adee5d7e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62696e6172636f64652f6c61726176656c2d7365676d656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/binarcode/laravel-segment)[![GitHub Tests Action Status](https://camo.githubusercontent.com/906d7249da90a2b8f7849329c60b34007a03c7b13eaa2dc95a97657d5c6110e8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f62696e6172636f64652f6c61726176656c2d7365676d656e742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/binarcode/laravel-segment/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c0ac117c41ac8d7ca8ee802bf8b9384380d6794f1c9be460799e31ebbbdd3247/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f62696e6172636f64652f6c61726176656c2d7365676d656e742f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/binarcode/laravel-segment/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/4e578f21921ba91beb67339aa55704fd049a1b48db54f56151372ba9abdf1c6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62696e6172636f64652f6c61726176656c2d7365676d656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/binarcode/laravel-segment)

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](https://segment.com/docs)

[](#official-documentation)

Installation
------------

[](#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
-----

[](#usage)

### Track event

[](#track-event)

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

### Alias anonymous id to a real user id

[](#alias-anonymous-id-to-a-real-user-id)

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

### The Segment Identify

[](#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
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Eduard Lupacescu](https://github.com/binaryk)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 52.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~67 days

Recently: every ~84 days

Total

6

Last Release

1183d ago

Major Versions

0.5.0 → 1.0.02023-02-20

PHP version history (2 changes)0.0.1PHP ^8.0

1.0.0PHP ^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/dfbb03bb93526135d948c1232c28938180a944e65362263dda08545afa3fee6d?d=identicon)[binaryk](/maintainers/binaryk)

---

Top Contributors

[![binaryk](https://avatars.githubusercontent.com/u/6833714?v=4)](https://github.com/binaryk "binaryk (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (16 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (14 commits)")[![maloun96](https://avatars.githubusercontent.com/u/8277264?v=4)](https://github.com/maloun96 "maloun96 (6 commits)")[![forecho](https://avatars.githubusercontent.com/u/1725326?v=4)](https://github.com/forecho "forecho (1 commits)")

---

Tags

laravelbinarcodelaravel-segment

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/binarcode-laravel-segment/health.svg)

```
[![Health](https://phpackages.com/badges/binarcode-laravel-segment/health.svg)](https://phpackages.com/packages/binarcode-laravel-segment)
```

###  Alternatives

[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

208.8k](/packages/njoguamos-laravel-plausible)[tapp/filament-webhook-client

Add a Filament resource and a policy for Spatie Webhook client

1120.2k](/packages/tapp-filament-webhook-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
