Skip to content
Ahmed Abbas edited this page Apr 9, 2026 · 4 revisions

Convert PHP SDK

The Convert PHP SDK allows developers to integrate A/B testing, feature flags, and personalization into their PHP applications. It manages different user experiences and features based on visitor data and defined rules, while tracking visitor interactions and conversions.

Source Repository: php-sdk

flowchart TD
    A0["ConvertSDK / Core"]
    A1["Context"]
    A2["DataManager"]
    A3["RuleManager"]
    A4["BucketingManager"]
    A5["ApiManager"]
    A6["ExperienceManager"]
    A7["FeatureManager"]
    A8["EventManager"]
    A9["SegmentsManager"]
    A10["Config / Types"]
    A0 -- "Creates" --> A1
    A0 -- "Fetches config via" --> A5
    A0 -- "Fires events via" --> A8
    A1 -- "Runs experiments via" --> A6
    A1 -- "Runs features via" --> A7
    A1 -- "Accesses data via" --> A2
    A1 -- "Evaluates segments via" --> A9
    A1 -- "Releases queues via" --> A5
    A2 -- "Buckets via" --> A4
    A2 -- "Matches rules via" --> A3
    A2 -- "Enqueues tracking via" --> A5
    A2 -- "Fires events via" --> A8
    A2 -- "Uses types from" --> A10
    A6 -- "Gets data/buckets via" --> A2
    A7 -- "Gets data/buckets via" --> A2
    A9 -- "Matches rules via" --> A3
    A9 -- "Stores data via" --> A2
    A0 -- "Uses" --> A2
Loading

Key Differences from the JavaScript SDK

The PHP SDK shares the same architecture and bucketing algorithm as the JavaScript SDK, ensuring cross-SDK deterministic variation assignment. However, it is adapted for PHP's request-scoped execution model:

  • Synchronous execution — No Promises or async/await. All methods return results immediately.
  • Static factoryConvertSDK::create($config) replaces new ConvertSDK($config).
  • PSR integration — Uses PSR-3 (logging), PSR-16 (caching and data persistence), and PSR-18 (HTTP client).
  • No timeouts or timers — PHP requests complete in milliseconds; queue flushing uses register_shutdown_function instead of setTimeout.
  • PSR-16 cache as data store — The same cache used for config caching automatically serves as the visitor data store for cross-request persistence.
  • Typed DTOs — Return types use readonly PHP classes (BucketedVariation, BucketedFeature) and backed enums (FeatureStatus, RuleError).

Getting Started

PHP SDK

Core Concepts

How-To Guides

Contributing

Clone this wiki locally