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.
Architecture fit. alt-three/segment is a classic Laravel service-provider bridge: it wraps Segment's PHP SDK behind a container binding and facade, adds a publishable config file for the write key, and exposes a small tracking surface (track, identify, page, group, alias) through Laravel's service container. For a Laravel codebase this is the shape we want — no vendor code in controllers, config-driven credentials, testable via container swap. The problem is not the pattern, it's the payload: the package is a thin adapter over segmentio/analytics-php, and both the package and that SDK are effectively end-of-life. We would be adopting an adapter whose only real value is ~200 lines of glue we could own ourselves.
Integration feasibility. Composer-level compatibility is the gating issue. The package's last release is July 2020, which places its illuminate/* constraints in the Laravel 5.5–7 era. On Laravel 10/11, auto-discovery may still register the provider, but composer require will almost certainly fail on constraint resolution — and overriding constraints to force-install an archived telemetry bridge is a maintenance smell we should not accept. Feasibility is high only on a legacy Laravel 6/7 service that already depends on it; on a modern stack, the integration cost exceeds the build cost of a replacement.
Technical risk.
analytics-php consumer model (file-backed queue, flush-on-shutdown) is the riskiest part of the stack and is not something this package abstracts away.Key questions.
context enrichment?Http client?Stack fit. The conceptual fit is strong and the implementation fit is weak. A Laravel-native bridge with a facade and config is exactly how we want analytics wired, but the specific artifact is pinned to a PHP/Laravel generation we should not be adding to. Treat the package as a reference implementation of the interface, not a dependency.
Migration path. Recommended: vendor-by-reimplementation. Define our own Tracker contract (track, identify, group, page, alias) in the app, bind it in a service provider, and implement it against Segment's HTTP Tracking API using Laravel's Http facade with retry and timeout. Optionally mirror the package's facade and config keys (services.segment.write_key) so existing call sites — if any — need no edits. This preserves the developer experience of the original package while removing the archived dependency entirely. Where a team insists on the SDK, the fallback is to fork the bridge, bump illuminate/* constraints, and accept ownership — a decision that must be explicit, not incidental.
Compatibility. Auto-discovery (Laravel 5.5+) means the provider can register itself, which is convenient but also means a constraint-forced install could half-work and fail at runtime rather than at composer install. If we do anything with this package on a legacy app, pin the exact version and add a lockfile check in CI. Verify facade alias registration against config/app.php for pre-5.5 apps.
Sequencing.
Tracker contract and a NullTracker/LogTracker binding so feature code merges without a vendor decision.Maintenance. Archived upstream means the maintenance vector points at us. Owning a small HTTP adapter is roughly an order of magnitude cheaper than owning a fork of a third-party bridge plus its transitive SDK, and it eliminates the recurring "does this still install on the next Laravel major?" tax at every upgrade cycle.
Support. No upstream channel, no issue triage, no releases since mid-2020. Internal support burden falls to whoever owns the analytics domain, and the package's behavior must be documented from source rather than from docs. This is the strongest argument against adoption and the strongest argument for the reimplementation path.
Scaling. Analytics volume scales with request volume, and this is where the legacy SDK model hurts: batching through a file-backed consumer introduces disk I/O on the request path and flush-on-shutdown behavior that can add latency at process exit or lose buffered events on abrupt termination. Our adapter should push events onto a Laravel queue job, flush per-job, and keep HTTP off the hot path. That gives us backpressure control, retries, and a dead-letter path the original package never had.
Failure modes.
properties arrays shipped to a third party. Mitigate with an allow-list and a schema test.Ramp-up. Low. The API surface is five methods and the config is a write key; any Laravel developer can be productive in under an hour. That cuts both ways — it means the package's core value proposition is small enough that the build-versus-buy calculus clearly favors building, and the team's ramp-up on a 150-line adapter is effectively zero.
How can I help you explore Laravel packages today?