customergauge/session
A Laravel package that captures and persists visitor session data such as landing pages, referrers, UTM parameters, and campaign attribution, making it easy to track how users arrive and move through your application across requests with minimal configuration.
Architecture fit. The package targets a real and narrow seam: backing Laravel's Illuminate\Contracts\Session\Session contract with PHP's native $_SESSION superglobal so that SessionGuard reads and writes auth state that legacy PHP code can also see. This is the correct extension point — Laravel's SessionGuard depends on the session contract, not a concrete store, so an adapter can be dropped in without forking the framework. That is a genuinely positive architectural signal.
The caveat is that "implements the contract" is a much larger surface than get/put/forget. SessionGuard::logout() calls migrate(true) and regenerateToken(); login() writes the guard name and queues a recaller cookie; flash data uses a flashbag with its own age-out semantics. An adapter that only shims the common methods will pass a smoke test and fail in production on logout, remember-me, and flashed validation errors.
Integration feasibility. Feasible, but only for the use case it was clearly built for: a hybrid deployment where a legacy plain-PHP application and a Laravel application share one session cookie and one $_SESSION array. In that topology the package is the bridge. Four things must be reconciled explicitly: (1) StartSession middleware must not double-start a session; (2) the native session cookie name must be added to EncryptCookies::$except, because Laravel encrypts its own cookie and PHP does not; (3) CSRF token lifecycle must be unified or VerifyCsrfToken disabled on bridged routes; (4) cookie flags (secure, httponly, samesite, domain, path) are configured in php.ini rather than config/session.php and will drift.
Technical risk. Elevated, and mostly not about the code:
migrate()/invalidate() correctly mapping to session_regenerate_id(true). A mismatch here is a silent vulnerability, not a visible bug. Same for token regeneration on login.$_SESSION is process-global. This is hostile to parallel PHPUnit/Pest runs and outright dangerous under Octane, Swoole, or RoadRunner, where request isolation is not what a superglobal implies. Cross-user data leakage is the catastrophic failure mode.Key questions. Which Laravel majors are actually supported — does the illuminate/session constraint resolve against L11/L12, where the contract has moved? Does it implement flashbags, token, and migrate() fully, or only the auth-path subset? Is the goal coexistence with a named legacy app, or replacing Laravel's driver outright? How is $_SESSION isolated in tests and under Octane? Is the source available to vendor and fork under MIT, and will CustomerGauge commit to any support posture in writing?
Stack fit. Best fit: PHP 8.1+, Laravel 10–12, deployed as a single vhost where /legacy/* is plain PHP and /app/* is Laravel, sharing one session cookie. Worst fit: greenfield Laravel, where redis, database, or cookie drivers are superior on isolation, scalability, testability, and encryption, with zero added dependency.
Migration path. Adopt behind a config flag so rollback is a one-line change:
customergauge/session directly in production.config/session.php at it.StartSession so only one session_start() occurs.EncryptCookies::$except.$_SESSION on both sides, or exempt bridged routes from VerifyCsrfToken.config/auth.php on the standard session guard — no changes needed if the contract is honored.Compatibility. With zero dependents, you are the first integration test at your Laravel version. Budget for writing contract tests against Illuminate\Contracts\Session\Session yourself; upstream almost certainly has not. Pin exact versions and re-run the contract suite on every Laravel minor bump.
Sequencing. Week 0: source and security audit, go/no-go. Week 1: proof of concept in a staging vhost with the real legacy app, validating login, logout, remember-me, flash messages, and CSRF round-trip. Week 2: contract test suite plus Octane/parallel-test behavior. Week 3: decide fork-and-own versus upstream dependency, then document the cookie/CSRF/regeneration contract in an ADR. Ship behind the flag, observe for one release cycle, then remove the fallback.
Maintenance. High relative to the package's size. MIT means you can fork; given 9 stars and 0 dependents, assume you will. Treat upstream as a reference implementation, not a supply-chain dependency. The recurring cost is tracking the illuminate/session contract across Laravel majors — roughly an annual breaking-change surface, small in lines, non-trivial in blast radius.
Support. No meaningful community, no evidence of an SLA, no issue-tracker velocity to point at. If CustomerGauge walks away, you own the code outright. That is acceptable for a few-hundred-line adapter and unacceptable if scope creeps into general session management.
Scaling. Native file sessions do not scale horizontally without shared storage. Setting session.save_handler = redis works, but you inherit PHP's serialization format rather than Laravel's, so the session cannot be shared with a Laravel-redis-session application — an important constraint if you ever want to split the monolith. Watch the locking behavior: PHP's file handler serializes concurrent requests per session, and that shows up as latency, not as errors, so it hides in dashboards.
Failure modes to instrument for:
session_start() — warnings plus silent data loss.laravel_session vs PHPSESSID) — two sessions, users appear to log out at random.session_regenerate_id on login — session fixation, no visible symptom.$_SESSION bleed under Octane or queue workers — cross-user leakage. Do not run this under Octane without an explicit isolation test.Ramp-up. Small code volume, moderate domain knowledge. The engineer needs fluency in both Laravel's auth internals and native PHP session semantics — a narrower combination than it sounds. Estimate 2–4 days for a senior Laravel engineer to reach confident productivity, plus a dedicated security review pass. Write the cookie/CSRF/regeneration contract down in an ADR; it is exactly the kind of implicit invariant a future engineer will "clean up" and break authentication with.
Verdict. Legitimate approach, correct extension seam, and a real problem for hybrid legacy/Laravel estates. But the adoption signals — 9 stars, 0 dependents, single vendor, low opportunity score — mean you should adopt the pattern and own the code. Justify only against a concrete legacy-session-coexistence requirement. Absent that, Laravel's native drivers dominate on every dimension and this package adds risk without adding capability.
How can I help you explore Laravel packages today?