Download the PHP package phillipsharring/handlr-module-ab without Composer
On this page you can find all versions of the php package phillipsharring/handlr-module-ab. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phillipsharring/handlr-module-ab
More information about phillipsharring/handlr-module-ab
Files in phillipsharring/handlr-module-ab
Package handlr-module-ab
Short Description A/B testing module for handlr apps -- deterministic variant assignment, event capture, and results.
License MIT
Informations about the package handlr-module-ab
handlr-module-ab
A/B testing module for handlr apps. Deterministic, session-scoped variant assignment; a {{#ab}} Handlebars helper for variant markup; and conversion capture with aggregated daily counts.
📖 Documentation: https://phillipsharring.github.io/handlr-mono/modules/ab
Install
One module, two manifests, lockstep version. Composer installs the PHP backend (service provider, pipes, tables, migrations); npm installs the frontend (Handlebars helper + client runtime).
Setup
1. Register the service provider in backend/app/config.php:
This auto-registers the routes (under the app's existing api.public and api.admin junctions) and the migrations. Seed data (which tests exist) stays app-owned.
2. Wire the frontend in your app entry (e.g. frontend/src/app.js):
3. Run the migrations to create the ab_tests and ab_events tables:
What's included
Backend (Handlr\Module\Ab\)
Routes registered on the app's junctions:
| Method | Path | Junction | Pipe |
|---|---|---|---|
| GET | /api/ab/assignments |
api.public |
GetAbAssignments |
| POST | /api/ab/capture |
api.public |
CaptureAbEvent |
| GET | /api/admin/ab |
api.admin |
GetAbTests |
| POST | /api/admin/ab |
api.admin |
PostCreateAbTest |
| GET | /api/admin/ab/{id} |
api.admin |
GetAbTestResults |
| PATCH | /api/admin/ab/{id} |
api.admin |
PatchUpdateAbTest |
AbService— deterministicassignVariant()(crc32 of session + test name), assignment lookup, and event recording.ab_tests/ab_eventstable migrations (auto-discovered viamigrationPaths()). Seed data (which tests to run) is app-owned — define it in your app's seeds againstHandlr\Module\Ab\Data\AbTestsTable.- Dispatches the
ab.event.capturedevent (AbEventCapturedEvent) on each capture, so apps can listen.
Frontend
registerAbHelpers(Handlebars)— the{{#ab "test" "variant"}}…{{/ab}}block helper.ab.init()— fetches assignments once per page lifetime, re-applies after boosted navigation, and delegatesdata-ab-captureclicks.capture(event)/getAssignments()— programmatic conversion tracking.
Markup conventions:
Removal
- Remove
AbServiceProvider::classfromconfig.php. - Remove the
registerAbHelpers/abimports from the app entry. composer remove phillipsharring/handlr-module-abandnpm uninstall @phillipsharring/handlr-module-ab.- Roll back the migrations (or drop the
ab_eventsandab_teststables).
Requires
phillipsharring/handlr-backend^0.8 (the framework release where A/B was extracted out of core)@phillipsharring/handlr-frontend^0.8 (peer — providesapiFetchand the boosted-nav lifecycle hooks)
License
MIT