WorkOS PHP SDK

FeatureFlags
in package

Table of Contents

Properties

$client  : HttpClient

Methods

__construct()  : mixed
addFlagTarget()  : mixed
Add a feature flag target
disableFeatureFlag()  : FeatureFlag
Disable a feature flag
enableFeatureFlag()  : FeatureFlag
Enable a feature flag
getFeatureFlag()  : Flag
Get a feature flag
listFeatureFlags()  : PaginatedResponse<string|int, Flag>
List feature flags
listOrganizationFeatureFlags()  : PaginatedResponse<string|int, Flag>
List enabled feature flags for an organization
listUserFeatureFlags()  : PaginatedResponse<string|int, Flag>
List enabled feature flags for a user
removeFlagTarget()  : void
Remove a feature flag target

Properties

Methods

addFlagTarget()

Add a feature flag target

public addFlagTarget(string $resourceId, string $slug[, RequestOptions|null $options = null ]) : mixed

Enables a feature flag for a specific target in the current environment. Currently, supported targets include users and organizations.

Parameters
$resourceId : string

The resource ID in format "user_" or "org_".

$slug : string

The unique slug identifier of the feature flag.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

getFeatureFlag()

Get a feature flag

public getFeatureFlag(string $slug[, RequestOptions|null $options = null ]) : Flag

Get the details of an existing feature flag by its slug.

Parameters
$slug : string

A unique key to reference the Feature Flag.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
Flag

listFeatureFlags()

List feature flags

public listFeatureFlags([string|null $before = null ][, string|null $after = null ][, int|null $limit = null ][, EventsOrder $order = EventsOrder::Desc ][, RequestOptions|null $options = null ]) : PaginatedResponse<string|int, Flag>

Get a list of all of your existing feature flags matching the criteria specified.

Parameters
$before : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$after : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$limit : int|null = null

Upper limit on the number of objects to return, between 1 and 100. Defaults to 10.

$order : EventsOrder = EventsOrder::Desc

Order the results by the creation time. Defaults to "desc".

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
PaginatedResponse<string|int, Flag>

listOrganizationFeatureFlags()

List enabled feature flags for an organization

public listOrganizationFeatureFlags(string $organizationId[, string|null $before = null ][, string|null $after = null ][, int|null $limit = null ][, EventsOrder $order = EventsOrder::Desc ][, RequestOptions|null $options = null ]) : PaginatedResponse<string|int, Flag>

Get a list of all enabled feature flags for an organization.

Parameters
$organizationId : string

Unique identifier of the Organization.

$before : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$after : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$limit : int|null = null

Upper limit on the number of objects to return, between 1 and 100. Defaults to 10.

$order : EventsOrder = EventsOrder::Desc

Order the results by the creation time. Defaults to "desc".

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
PaginatedResponse<string|int, Flag>

listUserFeatureFlags()

List enabled feature flags for a user

public listUserFeatureFlags(string $userId[, string|null $before = null ][, string|null $after = null ][, int|null $limit = null ][, EventsOrder $order = EventsOrder::Desc ][, RequestOptions|null $options = null ]) : PaginatedResponse<string|int, Flag>

Get a list of all enabled feature flags for the provided user. This includes feature flags enabled specifically for the user as well as any organizations that the user is a member of.

Parameters
$userId : string

The ID of the user.

$before : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$after : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$limit : int|null = null

Upper limit on the number of objects to return, between 1 and 100. Defaults to 10.

$order : EventsOrder = EventsOrder::Desc

Order the results by the creation time. Defaults to "desc".

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
PaginatedResponse<string|int, Flag>

removeFlagTarget()

Remove a feature flag target

public removeFlagTarget(string $resourceId, string $slug[, RequestOptions|null $options = null ]) : void

Removes a target from the feature flag's target list in the current environment. Currently, supported targets include users and organizations.

Parameters
$resourceId : string

The resource ID in format "user_" or "org_".

$slug : string

The unique slug identifier of the feature flag.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

        
On this page

Search results