WorkOS PHP SDK

DirectoryUserWithGroups
in package
implements JsonSerializable uses JsonSerializableTrait

Read onlyYes

Table of Contents

Interfaces

JsonSerializable

Properties

$createdAt  : DateTimeImmutable
An ISO 8601 timestamp.
$customAttributes  : array<string, mixed>
An object containing the custom attribute mapping for the Directory Provider.
$directoryId  : string
The identifier of the Directory the Directory User belongs to.
$email  : string|null
The email address of the user.
$emails  : array<string|int, DirectoryUserWithGroupsEmail>|null
A list of email addresses for the user.
$firstName  : string|null
The first name of the user.
$groups  : array<string|int, DirectoryGroup>
The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance — the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships.
$id  : string
Unique identifier for the Directory User.
$idpId  : string
Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats.
$jobTitle  : string|null
The job title of the user.
$lastName  : string|null
The last name of the user.
$name  : string|null
The full name of the user.
$object  : string
Distinguishes the Directory User object.
$organizationId  : string
The identifier for the Organization in which the Directory resides.
$rawAttributes  : array<string, mixed>
The raw attributes received from the directory provider.
$role  : SlimRole|null
$roles  : array<string|int, SlimRole>|null
All roles assigned to the user.
$state  : DirectoryUserState
The state of the user.
$updatedAt  : DateTimeImmutable
An ISO 8601 timestamp.
$username  : string|null
The username of the user.

Methods

__construct()  : mixed
fromArray()  : self
jsonSerialize()  : array<string|int, mixed>
toArray()  : array<string|int, mixed>

Properties

$customAttributes

An object containing the custom attribute mapping for the Directory Provider.

public array<string, mixed> $customAttributes

$directoryId

The identifier of the Directory the Directory User belongs to.

public string $directoryId

$groups

The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance — the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships.

public array<string|int, DirectoryGroup> $groups

$idpId

Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats.

public string $idpId

$organizationId

The identifier for the Organization in which the Directory resides.

public string $organizationId

$rawAttributes

The raw attributes received from the directory provider.

public array<string, mixed> $rawAttributes

Methods

__construct()

public __construct(string $object, string $id, string $directoryId, string $organizationId, string $idpId, string|null $email, DirectoryUserState $state, array<string|int, mixed> $rawAttributes, array<string|int, mixed> $customAttributes, DateTimeImmutable $createdAt, DateTimeImmutable $updatedAt, array<string|int, mixed> $groups[, string|null $firstName = null ][, string|null $lastName = null ][, string|null $name = null ][, array<string|int, mixed>|null $emails = null ][, string|null $jobTitle = null ][, string|null $username = null ][, SlimRole|null $role = null ][, array<string|int, mixed>|null $roles = null ]) : mixed
Parameters
$object : string
$id : string
$directoryId : string
$organizationId : string
$idpId : string
$email : string|null
$state : DirectoryUserState
$rawAttributes : array<string|int, mixed>
$customAttributes : array<string|int, mixed>
$createdAt : DateTimeImmutable
$updatedAt : DateTimeImmutable
$groups : array<string|int, mixed>
$firstName : string|null = null
$lastName : string|null = null
$name : string|null = null
$emails : array<string|int, mixed>|null = null
$jobTitle : string|null = null
$username : string|null = null
$role : SlimRole|null = null
$roles : array<string|int, mixed>|null = null

fromArray()

public static fromArray(array<string|int, mixed> $data) : self
Parameters
$data : array<string|int, mixed>
Return values
self

jsonSerialize()

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>
On this page

Search results