jm/ab-bundle
jm/ab-bundle is a Symfony bundle for running A/B tests directly in your PHP application. Define experiments and variants, assign visitors consistently, render versions in Twig, and track conversions to compare performance without relying on an external testing service.
Architecture fit — low, and the framing is wrong. jm/ab-bundle is a Symfony 2.x bundle, not a Laravel package. It is built around Symfony's DI container, kernel event listeners, and Twig template-loading overrides. There is no service provider, no Blade integration, and no illuminate/* dependency. Any Laravel adoption is therefore a port, not an install — the deliverable is a re-implementation of the variant-assignment and template-resolution pattern, with the bundle itself serving only as a reference design.
What the package actually does is narrow and legible: persist a variant choice per visitor (cookie/session), and resolve a template name to one of N versioned variants at render time. That is roughly a few hundred lines of coordination logic. The intellectual property is the pattern, not the code.
Integration feasibility — feasible only as a rewrite. The useful extraction targets are:
Each of these has a clean idiomatic equivalent in Laravel: a ViewFinder decorator or view-name resolver, a middleware for session/cookie binding, and a config-driven experiment registry. Effort is small — a spike plus a focused implementation, not an integration project.
Technical risk — high, and mostly non-technical in nature.
Key questions for the requesting team:
Stack fit. Treat as not installable on a modern Laravel or Symfony stack. Fit is limited to a legacy Symfony 2 application, and even there the PHP version constraint is likely the blocker. Recommended position: reference implementation only; do not add as a dependency.
Migration path (Laravel target). Four small components, each independently shippable:
experiment_key + stable_subject_id (authenticated user ID, else a first-party visitor ID). Deterministic hashing is strictly better than the bundle's random-and-persist approach: it is idempotent, testable without mocks, survives cookie loss, and stays consistent across app servers.ViewFinder decorator that first attempts {view}.{variant} and falls back to the base view, with the fallback logged rather than silent.Compatibility. No shared surface with the original: different container, different templating, different event model, different PHP baseline. There is no incremental migration from the bundle to the port — it is a clean build. Do not attempt a shim.
Sequencing.
Do not sequence exposure logging after the first experiment ships. Retrofitting it invalidates the data already collected.
Maintenance. Full internal ownership from day one. There is no upstream to patch, no CVE feed, and no maintainer to escalate to. Because the delivered artifact is our own code, this cost is bounded and predictable — which is the strongest argument for porting over forking.
Support. No vendor, no community, no SLAs. Support burden lands on the owning team and must be reflected in on-call scope. Expect questions of the form "why did this user see variant B twice" — answerable only if exposure logging is in place.
Scaling. Runtime cost is negligible: one hash, one lookup, one cookie read per request. The real scaling concerns are elsewhere:
Failure modes to design against.
Ramp-up. Low for the code itself, moderate for domain judgment. An engineer can read the entire bundle in an afternoon. The harder skills are experiment design — assignment unit, exposure definition, metric selection, stopping rules — and those are not in the package. Budget for a statistician or analytics partner, not just an implementer.
Bottom line. The package is a reasonable 2013-era design sketch for template variant swapping and a poor foundation for a 2025 experimentation capability. Recommended decision: do not adopt; extract the pattern, re-implement deterministically, and invest the saved effort in exposure logging and cache-correctness, which are where the actual risk lives.
How can I help you explore Laravel packages today?