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

ActiveLibrary[API Development](/categories/api)

synchro/segment
===============

A Segment bridge for Laravel

v5.0.0(9mo ago)033MITPHPPHP ^8.2CI passing

Since Jul 6Pushed 9mo agoCompare

[ Source](https://github.com/Synchro/Segment)[ Packagist](https://packagist.org/packages/synchro/segment)[ RSS](/packages/synchro-segment/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (30)Used By (0)

[![Build Status](https://camo.githubusercontent.com/eb25793d6515d289701cb94ef6b0365dfdc9f0e8133f95b50f6a650b1703d93c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f53796e6368726f2f5365676d656e742f776f726b666c6f77732f74657374732e796d6c3f6272616e63683d6d61696e3f7374796c653d666c61742d737175617265)](https://github.com/Synchro/Segment/actions?query=workflow%3ATests)[![Packagist Downloads](https://camo.githubusercontent.com/8fd009128457d7b00156b6adb02312e664a59cac8d541c08360e6c5251882486/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796e6368726f2f7365676d656e743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/synchro/segment)[![Latest Version](https://camo.githubusercontent.com/d81b450fdaf0944a8bc9f138b3dde534811446693dfc03377e5f52ab5111e6de/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f53796e6368726f2f5365676d656e743f646973706c61795f6e616d653d746167267374796c653d666c61742d737175617265)](https://github.com/Synchro/Segment/releases)

This package is a [Segment](https://segment.com/) bridge for Laravel, which relies on [Segment's own PHP library](https://packagist.org/packages/segmentio/analytics-php). This version requires [PHP](https://php.net) 8.2 and up, and supports Laravel 11 – 12. This package was originally written by [Graham Campbell for Alt Three](https://github.com/AltThree/Segment), but was abandoned in April 2022. This fork was resurrected in April 2023 by [Marcus Bointon (@Synchro)](https://github.com/Synchro).

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

[](#installation)

Install the package using [Composer](https://getcomposer.org):

Version 4.0 of this package supports Laravel 9 and 10, and requires PHP 8.1 or later.

```
$ composer require synchro/segment:^4.0
```

Version 5.0 of this package supports Laravel 11 and 12, and requires PHP 8.2 or later.

```
$ composer require synchro/segment:^5.0
```

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

Configuration
-------------

[](#configuration)

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

[](#usage)

Once you've set your `write_key` value in the configuration, you're ready to go! For the most part you can follow [Segment's own instructions](https://segment.com/docs/libraries/php/quickstart) however, you'll want to replace the `Analytics` classname with `Segment` - plus, you don't need to call `class_alias`.

### Identify the user

[](#identify-the-user)

```
Segment::identify([
    'userId' => '12345abcde',
    'traits' => [
        'name' => 'James Brooks',
        'email' => 'test@test.com',
    ],
]);
```

### Track actions

[](#track-actions)

```
Segment::track([
    'userId' => '12345abcde',
    'event' => 'Did something',
    'properties' => [
        'was_awesome' => true,
    ],
]);
```

Tests
-----

[](#tests)

Run tests with `./vendor.bin/phpunit` or `composer test`.

Coding standards
----------------

[](#coding-standards)

Coding standards are checked and enforced using [Laravel Pint](https://github.com/laravel/pint) using the default Laravel coding standard. Check for coding standards and apply automatic fixes by running `./vendor/bin/pint` or `composer cs`. These checks are also run using GitHub actions.

Security
--------

[](#security)

Our security policy is available to read [here](https://github.com/AltThree/Segment/security/policy).

License
-------

[](#license)

This library is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance57

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 73.2% 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 ~153 days

Recently: every ~459 days

Total

25

Last Release

287d ago

Major Versions

v1.4.0 → v2.0.02017-08-06

2.0.x-dev → v3.0.02018-03-03

3.5.x-dev → v4.0.02023-04-12

4.0.x-dev → v5.0.02025-08-05

PHP version history (6 changes)v1.0.0PHP &gt;=5.5.9

v2.0.0PHP ^7.0

v3.0.0PHP ^7.1.3

3.5.x-devPHP ^8.0

v4.0.0PHP ^8.1

v5.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e7028bcadbec2ee934da04d4d6232600481ac137b30b724ef116dfd55dbe9a9?d=identicon)[Synchro](/maintainers/Synchro)

---

Top Contributors

[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (90 commits)")[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (24 commits)")[![MatanYadaev](https://avatars.githubusercontent.com/u/13586343?v=4)](https://github.com/MatanYadaev "MatanYadaev (4 commits)")[![jbrooksuk](https://avatars.githubusercontent.com/u/246103?v=4)](https://github.com/jbrooksuk "jbrooksuk (3 commits)")[![coquer](https://avatars.githubusercontent.com/u/1929689?v=4)](https://github.com/coquer "coquer (1 commits)")[![danrovito](https://avatars.githubusercontent.com/u/8322674?v=4)](https://github.com/danrovito "danrovito (1 commits)")

---

Tags

phpapilaravelBridgesegmentiosegmentsegment.com

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[joisarjignesh/bigbluebutton

BigBlueButton Server API Library for Laravel

162145.5k1](/packages/joisarjignesh-bigbluebutton)[anahkiasen/flickering

A modern interface for the Flickr API

535.9k1](/packages/anahkiasen-flickering)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)[dystcz/lunar-api

Dystore API layer for Lunar e-commerce package

411.1k3](/packages/dystcz-lunar-api)

PHPackages © 2026

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