Experimentation Lab
Interactive implementation reference
Feature SDK implementation

PHP

Server-side decisions for PHP applications and commerce platforms.

PHP server
This runtime cannot execute inside a Next.js browser process. The page shows the native, official SDK shape; use the JavaScript, React, or Next.js pages for a live decision and event round trip with the same project, flag, event, and visitor ID.

Implementation

Official docs ↗
composer require optimizely/optimizely-sdk
$client = OptimizelyFactory::createDefaultInstance(SDK_KEY);
$user = $client->createUserContext('visitor-123', ['plan' => 'pro']);
$decision = $user->decide('demo_flag');
$user->trackEvent('demo_purchase');