absurge / php
ABsurge PHP SDK for feature flags and A/B testing
v0.2.0
2026-07-15 13:46 UTC
Requires
- php: ^8.2
- illuminate/http: ^12.0|^13.0
This package is auto-updated.
Last update: 2026-07-15 13:48:53 UTC
README
PHP SDK for ABsurge — feature flags and A/B testing.
Uses Laravel's HTTP client (illuminate/http).
Install
composer require absurge/php
Usage
use ABsurge\ABsurge; $absurge = new ABsurge( publishableKey: 'pk_...', baseUrl: 'https://your-app.example/api/v1', environment: 'production', ); // Evaluate flags and experiments for a user $result = $absurge->evaluate('user-123', ['plan' => 'pro']); // Check a single flag $enabled = $absurge->isEnabled('new-checkout', 'user-123'); // Get experiment assignment $experiment = $absurge->getExperiment('pricing-test', 'user-123'); // Track events $absurge->trackExposure('pricing-test', 'user-123'); $absurge->trackConversion('pricing-test', 'user-123', 'purchase', 49.0);
API
| Method | Description |
|---|---|
evaluate($distinctId, $attributes = [], $flags = null, $experiments = null) |
Batch evaluate flags and experiments |
isEnabled($flag, $distinctId, $attributes = []) |
Boolean flag check |
getExperiment($experiment, $distinctId, $attributes = []) |
Experiment variant assignment |
trackExposure($experiment, $distinctId, $attributes = []) |
Record experiment exposure |
trackConversion($experiment, $distinctId, $event, $value = null, $properties = null) |
Record conversion |
trackReplay($experiment, $distinctId, $events, $durationMs = null) |
Upload session replay events |
Authenticate with your environment publishable key via the X-ABsurge-Key header (set automatically).
Requirements
- PHP 8.2+
illuminate/http^12.0 or ^13.0
License
MIT