Return Types & DTOs
PHP DTOs and backed enums
PHP DTOs (Data Transfer Objects) and backed enums used by the SDK.
DTOs (Readonly Classes)
BucketedVariation
Returned by runExperience() and runExperiences().
namespace ConvertSdk\DTO;
readonly class BucketedVariation
{
public function __construct(
public string $experienceId,
public string $experienceKey,
public string $variationId,
public string $variationKey,
public array $changes,
) {}
}| Property | Type | Description |
|---|---|---|
experienceId | string | The experience ID |
experienceKey | string | The experience key |
variationId | string | The variation ID |
variationKey | string | The variation key |
changes | array | The variation changes (feature change data) |
BucketedFeature
Returned by runFeature() and runFeatures().
namespace ConvertSdk\DTO;
readonly class BucketedFeature
{
public function __construct(
public string $featureId,
public string $featureKey,
public FeatureStatus $status,
public array $variables,
) {}
}| Property | Type | Description |
|---|---|---|
featureId | string | The feature ID |
featureKey | string | The feature key |
status | FeatureStatus | The feature status — a backed PHP enum (FeatureStatus::Enabled or FeatureStatus::Disabled) |
variables | array | The feature variables with their resolved values |
ConversionAttributes
Passed to trackConversion().
namespace ConvertSdk\DTO;
readonly class ConversionAttributes
{
public function __construct(
public ?array $ruleData = null,
public ?array $conversionData = null,
public ?array $conversionSetting = null,
) {}
}| Property | Type | Description |
|---|---|---|
ruleData | ?array | Key-value pairs used for goal rule matching |
conversionData | ?array<GoalData> | Transaction data entries (see GoalData below) |
conversionSetting | ?array | Tracking settings: forceMultipleTransactions (bool) — whether to accumulate revenue for the same visitor |
GoalData
Individual revenue/goal data entry, used within ConversionAttributes->conversionData.
namespace ConvertSdk\DTO;
readonly class GoalData
{
public function __construct(
public GoalDataKey $key,
public int|float|string $value,
) {}
}| Property | Type | Description |
|---|---|---|
key | GoalDataKey | A backed PHP enum — one of: Amount, ProductsCount, TransactionId, CustomDimension1..CustomDimension5 |
value | int|float|string | The value for this key |
Backed Enums
FeatureStatus
namespace ConvertSdk\Enums;
enum FeatureStatus: string
{
case Enabled = 'enabled';
case Disabled = 'disabled';
}RuleError
Returned by trackConversion() when rule evaluation fails.
namespace ConvertSdk\Enums;
enum RuleError: string
{
case NoDataFound = 'convert.com_no_data_found';
case NeedMoreData = 'convert.com_need_more_data';
}RuleError::NoDataFound— no matching data for the ruleRuleError::NeedMoreData— insufficient data provided to evaluate the rule
BucketingError
namespace ConvertSdk\Enums;
enum BucketingError: string
{
case VariationNotDecided = 'convert.com_variation_not_decided';
}GoalDataKey
Used with GoalData for conversion tracking.
namespace ConvertSdk\Enums;
enum GoalDataKey: string
{
case Amount = 'amount';
case TransactionId = 'transactionId';
case ProductsCount = 'productsCount';
case CustomDimension1 = 'customDimension1';
case CustomDimension2 = 'customDimension2';
case CustomDimension3 = 'customDimension3';
case CustomDimension4 = 'customDimension4';
case CustomDimension5 = 'customDimension5';
}| Key | Backed Value | Type |
|---|---|---|
GoalDataKey::Amount | 'amount' | int|float |
GoalDataKey::ProductsCount | 'productsCount' | int |
GoalDataKey::TransactionId | 'transactionId' | string |
GoalDataKey::CustomDimension1 | 'customDimension1' | int|float|string |
GoalDataKey::CustomDimension2 | 'customDimension2' | int|float|string |
GoalDataKey::CustomDimension3 | 'customDimension3' | int|float|string |
GoalDataKey::CustomDimension4 | 'customDimension4' | int|float|string |
GoalDataKey::CustomDimension5 | 'customDimension5' | int|float|string |
SystemEvents
Used with the on() method for event subscriptions.
namespace ConvertSdk\Enums;
enum SystemEvents: string
{
case Ready = 'ready';
case ConfigUpdated = 'config.updated';
case ApiQueueReleased = 'api.queue.released';
case Bucketing = 'bucketing';
case Conversion = 'conversion';
case Segments = 'segments';
case LocationActivated = 'location.activated';
case LocationDeactivated = 'location.deactivated';
case Audiences = 'audiences';
case DataStoreQueueReleased = 'datastore.queue.released';
}
Core::on()takes astring, not the enum — passSystemEvents::Ready->value.Segments,Audiences, andDataStoreQueueReleasedare defined but never emitted by the PHP SDK; see Code Examples → Available Events.
LogLevel
Used in the logger configuration. Int-backed, ordered from most to least verbose: a client configured at a given level receives messages at that level and every more-severe one (higher backed value), and Silent suppresses output entirely.
namespace ConvertSdk\Enums;
enum LogLevel: int
{
case Trace = 0;
case Debug = 1;
case Info = 2;
case Warn = 3;
case Error = 4;
case Silent = 5;
}EntityType
Used with getConfigEntity() and getConfigEntityById().
namespace ConvertSdk\Enums;
enum EntityType: string
{
case Audience = 'audience';
case Location = 'location';
case Segment = 'segment';
case Feature = 'feature';
case Goal = 'goal';
case Experience = 'experience';
case Variation = 'variation';
}ConversionSettingKey
Used as the key of ConversionAttributes->conversionSetting.
namespace ConvertSdk\Enums;
enum ConversionSettingKey: string
{
case ForceMultipleTransactions = 'forceMultipleTransactions';
}Because conversionSetting is a plain array, pass the backed value: [ConversionSettingKey::ForceMultipleTransactions->value => true]. See Force Multiple Transactions.
SegmentsKeys
The reporting-segment keys the SDK recognises. setDefaultSegments() filters its argument against exactly this set and persists only the matches — any other key is discarded, not stored as a visitor property. (When the same keys are passed to createContext(), the non-segment ones do become visitor properties for targeting.)
namespace ConvertSdk\Enums;
enum SegmentsKeys: string
{
case Country = 'country';
case Browser = 'browser';
case Devices = 'devices';
case Source = 'source';
case Campaign = 'campaign';
case VisitorType = 'visitorType';
case CustomSegments = 'customSegments';
}
VisitorTypeandCustomSegmentsare camelCase (visitorType,customSegments) — matching the JavaScript SDK and the stored visitor-data shape. Earlier releases used the snake_case valuesvisitor_typeandcustom_segments.
RuleType
Audience rule types the SDK resolves itself rather than matching against supplied visitor data. Internal — you never construct or receive one, but it is what makes the mutual-exclusion rule work.
namespace ConvertSdk\Enums;
enum RuleType: string
{
case BucketedIntoExperienceKey = 'bucketed_into_experience_key';
}When an audience's sole rule is bucketed_into_experience_key, the SDK resolves it read-only against the visitor's stored bucketing decisions — it never buckets the target experience, writes state, or sends an event. An unknown target key resolves to "not bucketed" and logs a warning naming the key. See Mutually Exclusive Experiments.
Auto-Generated Types
The ConfigResponseData, ConfigExperience, ConfigFeature, and other configuration types are auto-generated from the Convert API OpenAPI specification. These are provided by the OpenAPI\Client package and ensure the SDK's understanding of data structures matches the Convert servers exactly.
Updated about 1 month ago