Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Segment Laravel Package

alt-three/segment

Laravel integration for Segment analytics that makes it simple to identify users and track events from your application. Includes a service provider, facade, and configuration for sending server-side analytics data to Segment.

View on GitHub
Deep Wiki
Context7

A Segment bridge for Laravel.

Frequently asked questions about Segment
How do I install alt-three/segment in a Laravel application?
Run composer require alt-three/segment, then publish the package configuration and set your Segment write key. On Laravel 5.5 through 7 the service provider and facade are auto-discovered. On modern Laravel versions the install will likely fail on illuminate constraints, so this is not a drop-in for Laravel 10 or 11.
Which Laravel versions does alt-three/segment support?
Its Composer constraints align with Laravel 5.5 through 7, and the last release was July 2020. It supports Laravel package auto-discovery, so the service provider can register automatically on those versions. On Laravel 10 and 11, composer require will almost certainly fail on constraint resolution.
Is alt-three/segment still maintained?
No. The repository is archived, the last release was July 2020, and there is no security or bug response. It also depends on the effectively end-of-life segmentio/analytics-php SDK. Treat it as a reference implementation rather than a dependency for new projects.
How do I configure the Segment write key with this package?
Publish the package configuration file and set the Segment write key there, preferably sourced from an environment variable instead of being committed. The write key is the credential Segment needs for server-side tracking. The package loads this configuration through its Laravel service provider.
How do I track events using the Segment facade?
Resolve the Segment facade and call track with an event name and properties array, for example Segment::track('Order Completed', ['order_id' => 123]). The facade proxies to the underlying Segment PHP client, so payloads follow Segment's Tracking API event schema. For anything beyond simple calls, check the SDK version pinned by the bridge.
How do I identify users and record page views with alt-three/segment?
Use the facade's identify method with a user ID and traits array to associate subsequent events with that user. Page, group, and alias calls are exposed through the same facade for page views, account grouping, and identity merging. These methods proxy to the Segment PHP client, so their semantics match Segment's API.
Why does composer require alt-three/segment fail on Laravel 10 or 11?
The package's illuminate constraints date from the Laravel 5.5 to 7 era, so Composer cannot resolve them against Laravel 10 or 11. Auto-discovery may still register the provider if you force-install, but overriding constraints to keep an archived telemetry bridge is a maintenance risk. The safer path is reimplementation rather than force-installation.
Can I fake or mock Segment analytics calls in Laravel tests?
The tracker is bound in Laravel's service container behind a facade, so you can swap the binding for a fake and assert calls without network traffic. The package does not provide a first-class fake, so you would define your own test double matching track, identify, page, group, and alias. A replacement adapter over Segment's HTTP Tracking API can be tested with Laravel's Http fake.
Does alt-three/segment support batching, retries, consent gating, or data scrubbing?
No. It is a thin adapter over segmentio/analytics-php, so batching, file-backed queueing, and flush-on-shutdown behavior come from that legacy SDK rather than the Laravel package. Consent gating, event allow-listing, property scrubbing, and retry or backoff controls are not first-class features. On transport errors the default behavior is to drop events rather than surface them.
What should I use instead of alt-three/segment for Laravel Segment integration?
For new work, implement a small internal tracker contract and call Segment's HTTP Tracking API through Laravel's Http client with retry and timeout. That preserves the facade and config developer experience without the archived dependency. If you must use an SDK, choose a maintained Segment SDK rather than the legacy analytics-php wrapper.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource