PHP_SDK.md•2.45 MB
# PHP_SDK Documentation
> Compiled from: https://github.com/evansims/openfga-php
> Generated: 2025-08-03 22:13:35 UTC
---
<!-- Source: evansims/openfga-php/README.md -->
<div align="center">
<p><a href="https://openfga.dev"><img src=".github/openfga.png" width="100" /></a></p>
<h1>OpenFGA PHP SDK</h1>
<p>
<a href="https://codecov.io/gh/evansims/openfga-php" target="_blank"><img src="https://codecov.io/gh/evansims/openfga-php/graph/badge.svg?token=DYXXS91T0S" alt="codecov" /></a>
<a href="https://shepherd.dev/github/evansims/openfga-php" target="_blank"><img src="https://shepherd.dev/github/evansims/openfga-php/coverage.svg" alt="Psalm Type Coverage" /></a>
<a href="https://www.bestpractices.dev/projects/10666"><img src="https://www.bestpractices.dev/projects/10666/badge"></a>
</p>
<p>Stop writing authorization logic. Start asking questions.</p>
<p><code>composer require evansims/openfga-php</code></p>
</div>
<p><br /></p>
**Every app needs permissions.** Most developers end up with authorization logic scattered across controllers, middleware, and business logic. Changes break things. New features require touching dozens of files.
**[OpenFGA](https://openfga.dev/) solves this.** Define your authorization rules once, query them anywhere. This SDK provides a modern PHP interface to [OpenFGA](https://openfga.dev/) and [Auth0 FGA](https://auth0.com/fine-grained-authorization).
<p><br /></p>
### Installation
```bash
composer require evansims/openfga-php
```
<p><br /></p>
### Quickstart
```php
use OpenFGA\Client;
use function OpenFGA\{allowed, tuple};
$client = new Client(url: 'http://localhost:8080');
// Instead of scattered if statements in your controllers:
if ($user->isAdmin() || $user->owns($document) || $user->team->canEdit($document)) {
// ...
}
// Ask OpenFGA:
$canEdit = allowed(
client: $client,
store: 'my-store',
model: 'my-model',
tuple: tuple('user:alice', 'editor', 'document:readme')
);
// Zero business logic coupling. Pure authorization.
```
See [the documentation](https://github.com/evansims/openfga-php/wiki) to get started.
<p><br /></p>
### Contributing
Contributions are welcome—have a look at our [contributing guidelines](https://github.com/evansims/openfga-php/blob/main/.github/CONTRIBUTING.md).
<!-- End of evansims/openfga-php/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Authentication/AccessToken.md -->
### AccessToken
Immutable access token implementation for OpenFGA API authentication. This class represents an OAuth 2.0 access token with expiration tracking and scope management. Access tokens are typically obtained through OAuth flows and provide time-limited access to OpenFGA resources.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getExpires()`](#getexpires)
- [`getScope()`](#getscope)
- [`getToken()`](#gettoken)
- [`isExpired()`](#isexpired)
</details>
#### Namespace
`OpenFGA\Authentication`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessToken.php)
#### Implements
- [`AccessTokenInterface`](https://github.com/evansims/openfga-php/blob/main/AccessTokenInterface.md)
- `Stringable`
#### Related Classes
- [AccessTokenInterface](https://github.com/evansims/openfga-php/blob/main/Authentication/AccessTokenInterface.md) (interface)
#### Methods
##### fromResponse
*<small>Implements Authentication\AccessTokenInterface</small>*
```php
public function fromResponse(
ResponseInterface $response,
string|null $expectedIssuer = NULL,
string|null $expectedAudience = NULL,
): self
```
Create an access token instance from an OAuth server response. This factory method parses an HTTP response from an OAuth authorization server and extracts the access token information. The response should contain a JSON payload with the standard OAuth 2.0 token response fields including access_token, expires_in, and optionally scope. If the access token is a JWT and expectedIssuer/expectedAudience are provided, the JWT is validated to ensure the issuer and audience claims match the expected values from the OAuth client configuration.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessTokenInterface.php#L68)
###### Parameters
| Name | Type | Description |
| ------------------- | ----------------------------------------------------- | ----------------------------------------------- |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | The HTTP response from the OAuth token endpoint |
| `$expectedIssuer` | `string` | `null` | Optional expected issuer for JWT validation |
| `$expectedAudience` | `string` | `null` | Optional expected audience for JWT validation |
###### Returns
`self` — A new access token instance created from the response data
##### getExpires
```php
public function getExpires(): int
```
Get the Unix timestamp when this access token expires. The expiration timestamp indicates when the token is no longer valid for API requests. Applications should check this value before making requests and refresh the token when necessary to avoid authentication failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessToken.php#L116)
###### Returns
`int` — Unix timestamp representing when the token expires
##### getScope
```php
public function getScope(): ?string
```
Get the scope that defines the permissions granted by this access token. The scope represents the extent of access granted to the token bearer. Different scopes may provide access to different OpenFGA operations or resources. A null scope typically indicates full access or that scope restrictions are not applicable for this token.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessToken.php#L125)
###### Returns
`string` | `null` — The token scope defining granted permissions, or null if no scope is specified
##### getToken
```php
public function getToken(): string
```
Get the raw access token value. This method returns the actual token string that was issued by the authentication server. This is the same value returned by __toString() but provided as an explicit getter method for clarity.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessToken.php#L134)
###### Returns
`string` — The raw access token value
##### isExpired
```php
public function isExpired(): bool
```
Check whether this access token has expired and needs to be refreshed. This method compares the token's expiration time against the current time to determine if the token is still valid. Expired tokens cannot be used for API requests as they result in authentication failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessToken.php#L143)
###### Returns
`bool` — True if the token has expired and should be refreshed, false if still valid
<!-- End of evansims/openfga-php/docs/API/Authentication/AccessToken.md -->
<!-- Source: evansims/openfga-php/docs/API/Authentication/AccessTokenInterface.md -->
### AccessTokenInterface
Represents an access token for OpenFGA API authentication. Access tokens are credentials used to authenticate requests to the OpenFGA API. They are typically obtained through OAuth 2.0 flows (such as client credentials) and have a limited lifespan defined by their expiration time. Access tokens provide secure, time-limited access to OpenFGA resources without requiring the transmission of long-lived credentials with each request. This interface defines the contract for managing these tokens, including: - Token value retrieval for Authorization headers - Expiration checking to determine when token refresh is needed - Scope validation for permission boundaries - Token parsing from OAuth server responses
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getExpires()`](#getexpires)
- [`getScope()`](#getscope)
- [`getToken()`](#gettoken)
- [`isExpired()`](#isexpired)
</details>
#### Namespace
`OpenFGA\Authentication`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessTokenInterface.php)
#### Implements
- `Stringable`
#### Related Classes
- [AccessToken](https://github.com/evansims/openfga-php/blob/main/Authentication/AccessToken.md) (implementation)
#### Methods
##### getExpires
```php
public function getExpires(): int
```
Get the Unix timestamp when this access token expires. The expiration timestamp indicates when the token is no longer valid for API requests. Applications should check this value before making requests and refresh the token when necessary to avoid authentication failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessTokenInterface.php#L79)
###### Returns
`int` — Unix timestamp representing when the token expires
##### getScope
```php
public function getScope(): string|null
```
Get the scope that defines the permissions granted by this access token. The scope represents the extent of access granted to the token bearer. Different scopes may provide access to different OpenFGA operations or resources. A null scope typically indicates full access or that scope restrictions are not applicable for this token.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessTokenInterface.php#L91)
###### Returns
`string` | `null` — The token scope defining granted permissions, or null if no scope is specified
##### getToken
```php
public function getToken(): string
```
Get the raw access token value. This method returns the actual token string that was issued by the authentication server. This is the same value returned by __toString() but provided as an explicit getter method for clarity.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessTokenInterface.php#L102)
###### Returns
`string` — The raw access token value
##### isExpired
```php
public function isExpired(): bool
```
Check whether this access token has expired and needs to be refreshed. This method compares the token's expiration time against the current time to determine if the token is still valid. Expired tokens cannot be used for API requests as they result in authentication failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AccessTokenInterface.php#L113)
###### Returns
`bool` — True if the token has expired and should be refreshed, false if still valid
<!-- End of evansims/openfga-php/docs/API/Authentication/AccessTokenInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Authentication/AuthenticationInterface.md -->
### AuthenticationInterface
Interface for OpenFGA authentication strategies. This interface defines the contract for different authentication methods that can be used with the OpenFGA client. Authentication strategies handle the generation and management of authorization headers for API requests.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`getAuthenticationRequest()`](#getauthenticationrequest)
- [`getAuthorizationHeader()`](#getauthorizationheader)
- [`handleAuthenticationResponse()`](#handleauthenticationresponse)
- [`requiresAuthentication()`](#requiresauthentication)
</details>
#### Namespace
`OpenFGA\Authentication`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AuthenticationInterface.php)
#### Methods
##### getAuthenticationRequest
```php
public function getAuthenticationRequest(StreamFactoryInterface $streamFactory): RequestContext|null
```
Get an authentication request context if this strategy requires token acquisition. Returns a RequestContext for making an authentication request (such as OAuth token request) if the strategy needs to obtain tokens dynamically. Returns null for strategies that don't require authentication requests (like pre-shared tokens).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AuthenticationInterface.php#L31)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | ----------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | Factory for creating request body streams |
###### Returns
`RequestContext` | `null` — The authentication request context, or null if not needed
##### getAuthorizationHeader
```php
public function getAuthorizationHeader(): string|null
```
Get the authorization header value for API requests. Returns the authorization header value to be included in HTTP requests to the OpenFGA API. The format and content depend on the specific authentication strategy implementation. For strategies that need to perform authentication requests (like OAuth), this method may trigger an authentication flow using getAuthenticationRequest().
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AuthenticationInterface.php#L45)
###### Returns
`string` | `null` — The authorization header value, or null if no authentication is needed
##### handleAuthenticationResponse
```php
public function handleAuthenticationResponse(ResponseInterface $response): void
```
Handle the authentication response and update internal state. This method is called by the Client after successfully sending an authentication request to update stored tokens or other authentication state. Implementations that don't require response handling can provide an empty implementation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AuthenticationInterface.php#L56)
###### Parameters
| Name | Type | Description |
| ----------- | ----------------------------------------------------- | --------------------------- |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | The authentication response |
###### Returns
`void`
##### requiresAuthentication
```php
public function requiresAuthentication(): bool
```
Check if authentication is required for this strategy.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/AuthenticationInterface.php#L63)
###### Returns
`bool` — True if this strategy provides authentication, false for no-auth strategies
<!-- End of evansims/openfga-php/docs/API/Authentication/AuthenticationInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Authentication/ClientCredentialAuthentication.md -->
### ClientCredentialAuthentication
OAuth 2.0 Client Credentials authentication strategy for OpenFGA client. This authentication strategy implements the OAuth 2.0 Client Credentials flow for authenticating with the OpenFGA API. It automatically handles token acquisition, caching, and refresh when tokens expire. The strategy requires client credentials (client ID and secret) along with the OAuth issuer and audience parameters. It automatically requests new tokens when the current token expires.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`clearToken()`](#cleartoken)
- [`getAuthenticationRequest()`](#getauthenticationrequest)
- [`getAuthorizationHeader()`](#getauthorizationheader)
- [`getToken()`](#gettoken)
- [`handleAuthenticationResponse()`](#handleauthenticationresponse)
- [`requiresAuthentication()`](#requiresauthentication)
</details>
#### Namespace
`OpenFGA\Authentication`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Authentication/ClientCredentialAuthentication.php)
#### Implements
- [`AuthenticationInterface`](https://github.com/evansims/openfga-php/blob/main/AuthenticationInterface.md)
#### Methods
##### clearToken
```php
public function clearToken(): void
```
Clear the current access token and force re-authentication. Removes the stored access token, forcing the authentication strategy to request a new token on the next API call. This is useful for handling authentication errors or forcing token refresh.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/ClientCredentialAuthentication.php#L75)
###### Returns
`void`
##### getAuthenticationRequest
```php
public function getAuthenticationRequest(
Psr\Http\Message\StreamFactoryInterface $streamFactory,
): ?OpenFGA\Network\RequestContext
```
Get an authentication request context if this strategy requires token acquisition. Returns a RequestContext for making an authentication request (such as OAuth token request) if the strategy needs to obtain tokens dynamically. Returns null for strategies that don't require authentication requests (like pre-shared tokens).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/ClientCredentialAuthentication.php#L86)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | ----------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | Factory for creating request body streams |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) | `null` — The authentication request context, or null if not needed
##### getAuthorizationHeader
```php
public function getAuthorizationHeader(): ?string
```
Get the authorization header value for API requests. Returns the authorization header value to be included in HTTP requests to the OpenFGA API. The format and content depend on the specific authentication strategy implementation. For strategies that need to perform authentication requests (like OAuth), this method may trigger an authentication flow using getAuthenticationRequest().
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/ClientCredentialAuthentication.php#L107)
###### Returns
`string` | `null` — The authorization header value, or null if no authentication is needed
##### getToken
```php
public function getToken(): AccessTokenInterface|null
```
Get the current access token if available. Returns the stored access token, which may be null if no authentication has been performed yet or if the token has been explicitly cleared. The returned token may be expired; use the token's isExpired() method to check validity.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/ClientCredentialAuthentication.php#L126)
###### Returns
[`AccessTokenInterface`](https://github.com/evansims/openfga-php/blob/main/AccessTokenInterface.md) | `null` — The current access token, or null if not authenticated
##### handleAuthenticationResponse
```php
public function handleAuthenticationResponse(ResponseInterface $response): void
```
Handle the authentication response and update the stored token. Processes the OAuth token response and creates a new access token from the response data. This method is automatically called by the Client after a successful authentication request. For JWT tokens, this method validates the issuer and audience claims against the OAuth configuration to ensure the token was issued by the expected authorization server and is intended for the correct audience.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/ClientCredentialAuthentication.php#L153)
###### Parameters
| Name | Type | Description |
| ----------- | ----------------------------------------------------- | ------------------------------------------------- |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | The authentication response from the OAuth server |
###### Returns
`void`
##### requiresAuthentication
```php
public function requiresAuthentication(): bool
```
Check if authentication is required for this strategy.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/ClientCredentialAuthentication.php#L166)
###### Returns
`bool` — True if this strategy provides authentication, false for no-auth strategies
<!-- End of evansims/openfga-php/docs/API/Authentication/ClientCredentialAuthentication.md -->
<!-- Source: evansims/openfga-php/docs/API/Authentication/README.md -->
## Authentication
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Authentication
Authentication providers and token management for OpenFGA API access.
**Total Components:** 5
### Interfaces
| Name | Description |
|------|-------------|
| [`AccessTokenInterface`](https://github.com/evansims/openfga-php/blob/main/./AccessTokenInterface.md) | Represents an access token for OpenFGA API authentication. Access tokens are credentials used to ... |
| [`AuthenticationInterface`](https://github.com/evansims/openfga-php/blob/main/./AuthenticationInterface.md) | Interface for OpenFGA authentication strategies. This interface defines the contract for differen... |
### Classes
| Name | Description |
|------|-------------|
| [`AccessToken`](https://github.com/evansims/openfga-php/blob/main/./AccessToken.md) | Immutable access token implementation for OpenFGA API authentication. This class represents an OA... |
| [`ClientCredentialAuthentication`](https://github.com/evansims/openfga-php/blob/main/./ClientCredentialAuthentication.md) | OAuth 2.0 Client Credentials authentication strategy for OpenFGA client. This authentication stra... |
| [`TokenAuthentication`](https://github.com/evansims/openfga-php/blob/main/./TokenAuthentication.md) | Token-based authentication strategy for OpenFGA client. This authentication strategy uses a pre-s... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Authentication/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Authentication/TokenAuthentication.md -->
### TokenAuthentication
Token-based authentication strategy for OpenFGA client. This authentication strategy uses a pre-shared token (such as a Bearer token or API key) for authentication with the OpenFGA API. The token is provided during construction and used as-is for all requests. This strategy is suitable for scenarios where you have a long-lived token or when implementing custom token refresh logic externally. The strategy accepts either a string token or an AccessTokenInterface instance for maximum flexibility.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`getAuthenticationRequest()`](#getauthenticationrequest)
- [`getAuthorizationHeader()`](#getauthorizationheader)
- [`getToken()`](#gettoken)
- [`handleAuthenticationResponse()`](#handleauthenticationresponse)
- [`requiresAuthentication()`](#requiresauthentication)
</details>
#### Namespace
`OpenFGA\Authentication`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Authentication/TokenAuthentication.php)
#### Implements
- [`AuthenticationInterface`](https://github.com/evansims/openfga-php/blob/main/AuthenticationInterface.md)
#### Methods
##### getAuthenticationRequest
```php
public function getAuthenticationRequest(
Psr\Http\Message\StreamFactoryInterface $streamFactory,
): ?OpenFGA\Network\RequestContext
```
Get an authentication request context if this strategy requires token acquisition. Returns a RequestContext for making an authentication request (such as OAuth token request) if the strategy needs to obtain tokens dynamically. Returns null for strategies that don't require authentication requests (like pre-shared tokens).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/TokenAuthentication.php#L47)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | ----------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | Factory for creating request body streams |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) | `null` — The authentication request context, or null if not needed
##### getAuthorizationHeader
```php
public function getAuthorizationHeader(): ?string
```
Get the authorization header value for API requests. Returns the authorization header value to be included in HTTP requests to the OpenFGA API. The format and content depend on the specific authentication strategy implementation. For strategies that need to perform authentication requests (like OAuth), this method may trigger an authentication flow using getAuthenticationRequest().
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/TokenAuthentication.php#L56)
###### Returns
`string` | `null` — The authorization header value, or null if no authentication is needed
##### getToken
```php
public function getToken(): AccessTokenInterface|string
```
Get the current authentication token. Returns the token that was provided during construction. This can be either a string token or an AccessTokenInterface instance depending on what was originally provided to the constructor.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/TokenAuthentication.php#L78)
###### Returns
[`AccessTokenInterface`](https://github.com/evansims/openfga-php/blob/main/AccessTokenInterface.md) | `string` — The authentication token used by this strategy
##### handleAuthenticationResponse
```php
public function handleAuthenticationResponse(Psr\Http\Message\ResponseInterface $response): void
```
Handle the authentication response and update internal state. This method is called by the Client after successfully sending an authentication request to update stored tokens or other authentication state. Implementations that don't require response handling can provide an empty implementation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/TokenAuthentication.php#L87)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------ | --------------------------- |
| `$response` | `Psr\Http\Message\ResponseInterface` | The authentication response |
###### Returns
`void`
##### requiresAuthentication
```php
public function requiresAuthentication(): bool
```
Check if authentication is required for this strategy.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Authentication/TokenAuthentication.php#L95)
###### Returns
`bool` — True if this strategy provides authentication, false for no-auth strategies
<!-- End of evansims/openfga-php/docs/API/Authentication/TokenAuthentication.md -->
<!-- Source: evansims/openfga-php/docs/API/Context/Context.md -->
### Context
Ambient Context Manager. Provides Python-style context management for PHP, allowing functions to access shared context without explicit parameter passing. This enables a more ergonomic API where client, store, and model can be set once and used implicitly by helper functions. Contexts support inheritance - child contexts automatically inherit values from their parent context unless explicitly overridden. This allows for flexible nesting where you can override just the pieces you need.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`current()`](#current)
- [`depth()`](#depth)
- [`getClient()`](#getclient)
- [`getModel()`](#getmodel)
- [`getPrevious()`](#getprevious)
- [`getStore()`](#getstore)
- [`hasContext()`](#hascontext)
- [`with()`](#with)
</details>
#### Namespace
`OpenFGA\Context`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Context/Context.php)
#### Implements
- [`ContextInterface`](https://github.com/evansims/openfga-php/blob/main/ContextInterface.md)
#### Related Classes
- [ContextInterface](https://github.com/evansims/openfga-php/blob/main/Context/ContextInterface.md) (interface)
#### Methods
##### current
*<small>Implements Context\ContextInterface</small>*
```php
public function current(): self
```
Get the current ambient context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L26)
###### Returns
`self`
##### depth
*<small>Implements Context\ContextInterface</small>*
```php
public function depth(): int
```
Get the current nesting depth of contexts.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L33)
###### Returns
`int` — The number of active contexts in the stack
##### getClient
*<small>Implements Context\ContextInterface</small>*
```php
public function getClient(): ClientInterface|null
```
Get the current client.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L40)
###### Returns
[`ClientInterface`](https://github.com/evansims/openfga-php/blob/main/ClientInterface.md) | `null` — The current client instance or null if not set
##### getModel
*<small>Implements Context\ContextInterface</small>*
```php
public function getModel(): AuthorizationModelInterface|string|null
```
Get the current authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L47)
###### Returns
[`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` — The current model instance, model ID, or null if not set
##### getPrevious
*<small>Implements Context\ContextInterface</small>*
```php
public function getPrevious(): ?self
```
Get the previous context in the stack.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L52)
###### Returns
`self` | `null`
##### getStore
*<small>Implements Context\ContextInterface</small>*
```php
public function getStore(): StoreInterface|string|null
```
Get the current store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L59)
###### Returns
[`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | `null` — The current store instance, store ID, or null if not set
##### hasContext
*<small>Implements Context\ContextInterface</small>*
```php
public function hasContext(): bool
```
Check if an ambient context is currently active.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L66)
###### Returns
`bool` — True if at least one context is active, false otherwise
##### with
*<small>Implements Context\ContextInterface</small>*
```php
public function with(
callable $fn,
?OpenFGA\ClientInterface $client = NULL,
StoreInterface|string|null $store = NULL,
AuthorizationModelInterface|string|null $model = NULL,
): T
```
Execute a callable within a new ambient context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php#L82)
###### Parameters
| Name | Type | Description |
| --------- | ---------------------------------------------------------------------------------------------------- | ------------------------------- |
| `$fn` | `callable` | |
| `$client` | [`ClientInterface`](https://github.com/evansims/openfga-php/blob/main/ClientInterface.md) | `null` | Optional client for the context |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | `null` | Optional store for the context |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` | Optional model for the context |
###### Returns
`T` — The result of the callable execution
<!-- End of evansims/openfga-php/docs/API/Context/Context.md -->
<!-- Source: evansims/openfga-php/docs/API/Context/ContextInterface.md -->
### ContextInterface
Manages ambient context for OpenFGA operations. This interface provides a way to manage and access contextual information (client, store, and model) throughout the execution of OpenFGA operations. It implements a stack-based context system that allows nested contexts.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA\Context`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Context/ContextInterface.php)
#### Related Classes
- [Context](https://github.com/evansims/openfga-php/blob/main/Context/Context.md) (implementation)
<!-- End of evansims/openfga-php/docs/API/Context/ContextInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Context/README.md -->
## Context
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Context
**Total Components:** 2
### Interfaces
| Name | Description |
|------|-------------|
| [`ContextInterface`](https://github.com/evansims/openfga-php/blob/main/./ContextInterface.md) | Manages ambient context for OpenFGA operations. This interface provides a way to manage and acces... |
### Classes
| Name | Description |
|------|-------------|
| [`Context`](https://github.com/evansims/openfga-php/blob/main/./Context.md) | Ambient Context Manager. Provides Python-style context management for PHP, allowing functions to ... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Context/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/EventDispatcher.md -->
### EventDispatcher
Simple event dispatcher implementation. Manages event listeners and dispatches events to registered handlers. Supports event propagation control for stoppable events.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`addListener()`](#addlistener)
- [`dispatch()`](#dispatch)
- [`getListeners()`](#getlisteners)
- [`hasListeners()`](#haslisteners)
- [`removeListeners()`](#removelisteners)
</details>
#### Namespace
`OpenFGA\Events`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcher.php)
#### Implements
- [`EventDispatcherInterface`](https://github.com/evansims/openfga-php/blob/main/EventDispatcherInterface.md)
#### Related Classes
- [EventDispatcherInterface](https://github.com/evansims/openfga-php/blob/main/Events/EventDispatcherInterface.md) (interface)
#### Methods
##### addListener
```php
public function addListener(string $eventType, callable $listener): void
```
Register an event listener for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcher.php#L28)
###### Parameters
| Name | Type | Description |
| ------------ | ---------- | ------------------------------------------------------- |
| `$eventType` | `string` | The class name or identifier of the event to listen for |
| `$listener` | `callable` | |
###### Returns
`void`
##### dispatch
```php
public function dispatch(OpenFGA\Events\EventInterface $event): void
```
Dispatch an event to all registered listeners. Calls all listeners registered for the given event's type. If an event is stoppable and a listener stops propagation, remaining listeners will not be called.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcher.php#L41)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------- | --------------------- |
| `$event` | [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/EventInterface.md) | The event to dispatch |
###### Returns
`void`
##### getListeners
```php
public function getListeners(string $eventType): array<callable(object): void>
```
Get all registered listeners for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcher.php#L63)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------------------- |
| `$eventType` | `string` | The event type to get listeners for |
###### Returns
`array<`callable(object): void`>` — Array of listeners for the event type
##### hasListeners
```php
public function hasListeners(string $eventType): bool
```
Check if there are any listeners for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcher.php#L72)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------- |
| `$eventType` | `string` | The event type to check |
###### Returns
`bool` — True if there are listeners, false otherwise
##### removeListeners
```php
public function removeListeners(string $eventType): void
```
Remove all listeners for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcher.php#L81)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ------------------------------------- |
| `$eventType` | `string` | The event type to clear listeners for |
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Events/EventDispatcher.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/EventDispatcherInterface.md -->
### EventDispatcherInterface
Event dispatcher interface for handling domain events. The event dispatcher decouples event publishers from subscribers, allowing for flexible event handling and observability without tight coupling between business logic and infrastructure concerns.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`addListener()`](#addlistener)
- [`dispatch()`](#dispatch)
- [`getListeners()`](#getlisteners)
- [`hasListeners()`](#haslisteners)
- [`removeListeners()`](#removelisteners)
</details>
#### Namespace
`OpenFGA\Events`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcherInterface.php)
#### Related Classes
- [EventDispatcher](https://github.com/evansims/openfga-php/blob/main/Events/EventDispatcher.md) (implementation)
#### Methods
##### addListener
```php
public function addListener(string $eventType, callable $listener): void
```
Register an event listener for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcherInterface.php#L22)
###### Parameters
| Name | Type | Description |
| ------------ | ---------- | ------------------------------------------------------- |
| `$eventType` | `string` | The class name or identifier of the event to listen for |
| `$listener` | `callable` | |
###### Returns
`void`
##### dispatch
```php
public function dispatch(EventInterface $event): void
```
Dispatch an event to all registered listeners. Calls all listeners registered for the given event's type. If an event is stoppable and a listener stops propagation, remaining listeners will not be called.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcherInterface.php#L33)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------- | --------------------- |
| `$event` | [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/EventInterface.md) | The event to dispatch |
###### Returns
`void`
##### getListeners
```php
public function getListeners(string $eventType): array<callable(object): void>
```
Get all registered listeners for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcherInterface.php#L41)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------------------- |
| `$eventType` | `string` | The event type to get listeners for |
###### Returns
`array<`callable(object): void`>` — Array of listeners for the event type
##### hasListeners
```php
public function hasListeners(string $eventType): bool
```
Check if there are any listeners for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcherInterface.php#L49)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------- |
| `$eventType` | `string` | The event type to check |
###### Returns
`bool` — True if there are listeners, false otherwise
##### removeListeners
```php
public function removeListeners(string $eventType): void
```
Remove all listeners for a specific event type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventDispatcherInterface.php#L56)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ------------------------------------- |
| `$eventType` | `string` | The event type to clear listeners for |
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Events/EventDispatcherInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/EventInterface.md -->
### EventInterface
Base interface for all domain events. Events represent something significant that happened in the domain. They are immutable value objects that capture the facts about what occurred.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`getEventId()`](#geteventid)
- [`getEventType()`](#geteventtype)
- [`getOccurredAt()`](#getoccurredat)
- [`getPayload()`](#getpayload)
- [`isPropagationStopped()`](#ispropagationstopped)
- [`stopPropagation()`](#stoppropagation)
</details>
#### Namespace
`OpenFGA\Events`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Events/EventInterface.php)
#### Methods
##### getEventId
```php
public function getEventId(): string
```
Get the unique identifier for this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventInterface.php#L22)
###### Returns
`string` — A unique identifier for the event instance
##### getEventType
```php
public function getEventType(): string
```
Get the name/type of this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventInterface.php#L29)
###### Returns
`string` — The event type identifier
##### getOccurredAt
```php
public function getOccurredAt(): DateTimeImmutable
```
Get when this event occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventInterface.php#L36)
###### Returns
`DateTimeImmutable` — The timestamp when the event was created
##### getPayload
```php
public function getPayload(): array<string, mixed>
```
Get the event payload data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventInterface.php#L43)
###### Returns
`array<`string`, `mixed`>` — The event data
##### isPropagationStopped
```php
public function isPropagationStopped(): bool
```
Check if event propagation should be stopped.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventInterface.php#L50)
###### Returns
`bool` — True if propagation should be stopped
##### stopPropagation
```php
public function stopPropagation(): void
```
Stop event propagation to remaining listeners.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/EventInterface.php#L55)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Events/EventInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/HttpRequestSentEvent.md -->
### HttpRequestSentEvent
Event fired when an HTTP request is sent to the OpenFGA API. This event contains the outgoing request details for telemetry and debugging.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`getEventId()`](#geteventid)
- [`getEventType()`](#geteventtype)
- [`getModelId()`](#getmodelid)
- [`getOccurredAt()`](#getoccurredat)
- [`getOperation()`](#getoperation)
- [`getPayload()`](#getpayload)
- [`getRequest()`](#getrequest)
- [`getStoreId()`](#getstoreid)
- [`isPropagationStopped()`](#ispropagationstopped)
- [`stopPropagation()`](#stoppropagation)
</details>
#### Namespace
`OpenFGA\Events`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpRequestSentEvent.php)
#### Implements
- [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/EventInterface.md)
#### Methods
##### getEventId
```php
public function getEventId(): string
```
Get the unique identifier for this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L40)
###### Returns
`string` — A unique identifier for the event instance
##### getEventType
```php
public function getEventType(): string
```
Get the name/type of this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L49)
###### Returns
`string` — The event type identifier
##### getModelId
```php
public function getModelId(): string|null
```
Get the model ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpRequestSentEvent.php#L46)
###### Returns
`string` | `null` — The model ID or null if not applicable
##### getOccurredAt
```php
public function getOccurredAt(): DateTimeImmutable
```
Get when this event occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L58)
###### Returns
`DateTimeImmutable` — The timestamp when the event was created
##### getOperation
```php
public function getOperation(): string
```
Get the OpenFGA operation name.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpRequestSentEvent.php#L56)
###### Returns
`string` — The operation name (for example, 'check', 'write', 'read')
##### getPayload
```php
public function getPayload(): array
```
Get the event payload data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L67)
###### Returns
`array` — The event data
##### getRequest
```php
public function getRequest(): RequestInterface
```
Get the HTTP request being sent.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpRequestSentEvent.php#L66)
###### Returns
[`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) — The PSR-7 request object
##### getStoreId
```php
public function getStoreId(): string|null
```
Get the store ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpRequestSentEvent.php#L76)
###### Returns
`string` | `null` — The store ID or null if not applicable
##### isPropagationStopped
```php
public function isPropagationStopped(): bool
```
Check if event propagation should be stopped.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L76)
###### Returns
`bool` — True if propagation should be stopped
##### stopPropagation
```php
public function stopPropagation(): void
```
Stop event propagation to remaining listeners.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L85)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Events/HttpRequestSentEvent.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/HttpResponseReceivedEvent.md -->
### HttpResponseReceivedEvent
Event fired when an HTTP response is received from the OpenFGA API. This event contains both the request and response for complete telemetry tracking.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`getEventId()`](#geteventid)
- [`getEventType()`](#geteventtype)
- [`getException()`](#getexception)
- [`getModelId()`](#getmodelid)
- [`getOccurredAt()`](#getoccurredat)
- [`getOperation()`](#getoperation)
- [`getPayload()`](#getpayload)
- [`getRequest()`](#getrequest)
- [`getResponse()`](#getresponse)
- [`getStoreId()`](#getstoreid)
- [`isPropagationStopped()`](#ispropagationstopped)
- [`isSuccessful()`](#issuccessful)
- [`stopPropagation()`](#stoppropagation)
</details>
#### Namespace
`OpenFGA\Events`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php)
#### Implements
- [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/EventInterface.md)
#### Methods
##### getEventId
```php
public function getEventId(): string
```
Get the unique identifier for this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L40)
###### Returns
`string` — A unique identifier for the event instance
##### getEventType
```php
public function getEventType(): string
```
Get the name/type of this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L49)
###### Returns
`string` — The event type identifier
##### getException
```php
public function getException(): Throwable|null
```
Get the exception if the request failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php#L53)
###### Returns
`Throwable` | `null` — The exception or null if the request succeeded
##### getModelId
```php
public function getModelId(): string|null
```
Get the model ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php#L63)
###### Returns
`string` | `null` — The model ID or null if not applicable
##### getOccurredAt
```php
public function getOccurredAt(): DateTimeImmutable
```
Get when this event occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L58)
###### Returns
`DateTimeImmutable` — The timestamp when the event was created
##### getOperation
```php
public function getOperation(): string
```
Get the OpenFGA operation name.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php#L73)
###### Returns
`string` — The operation name (for example, 'check', 'write', 'read')
##### getPayload
```php
public function getPayload(): array
```
Get the event payload data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L67)
###### Returns
`array` — The event data
##### getRequest
```php
public function getRequest(): RequestInterface
```
Get the HTTP request that was sent.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php#L83)
###### Returns
[`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) — The PSR-7 request object
##### getResponse
```php
public function getResponse(): ResponseInterface|null
```
Get the HTTP response received.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php#L93)
###### Returns
[`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` — The PSR-7 response object or null if an exception occurred
##### getStoreId
```php
public function getStoreId(): string|null
```
Get the store ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php#L103)
###### Returns
`string` | `null` — The store ID or null if not applicable
##### isPropagationStopped
```php
public function isPropagationStopped(): bool
```
Check if event propagation should be stopped.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L76)
###### Returns
`bool` — True if propagation should be stopped
##### isSuccessful
```php
public function isSuccessful(): bool
```
Check if the HTTP request was successful.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/HttpResponseReceivedEvent.php#L113)
###### Returns
`bool` — True if no exception occurred, false otherwise
##### stopPropagation
```php
public function stopPropagation(): void
```
Stop event propagation to remaining listeners.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L85)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Events/HttpResponseReceivedEvent.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/OperationCompletedEvent.md -->
### OperationCompletedEvent
Event fired when a high-level operation completes. This event tracks the completion of business operations with success/failure information.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getEventId()`](#geteventid)
- [`getEventType()`](#geteventtype)
- [`getException()`](#getexception)
- [`getModelId()`](#getmodelid)
- [`getOccurredAt()`](#getoccurredat)
- [`getOperation()`](#getoperation)
- [`getPayload()`](#getpayload)
- [`getResult()`](#getresult)
- [`getStoreId()`](#getstoreid)
- [`isPropagationStopped()`](#ispropagationstopped)
- [`isSuccessful()`](#issuccessful)
- [`stopPropagation()`](#stoppropagation)
</details>
#### Namespace
`OpenFGA\Events`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php)
#### Implements
- [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/EventInterface.md)
#### Methods
##### getContext
```php
public function getContext(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php#L50)
###### Returns
`array<`string`, `mixed`>`
##### getEventId
```php
public function getEventId(): string
```
Get the unique identifier for this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L40)
###### Returns
`string` — A unique identifier for the event instance
##### getEventType
```php
public function getEventType(): string
```
Get the name/type of this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L49)
###### Returns
`string` — The event type identifier
##### getException
```php
public function getException(): Throwable|null
```
Get the exception if the operation failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php#L60)
###### Returns
`Throwable` | `null` — The exception or null if the operation succeeded
##### getModelId
```php
public function getModelId(): string|null
```
Get the model ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php#L70)
###### Returns
`string` | `null` — The model ID or null if not applicable
##### getOccurredAt
```php
public function getOccurredAt(): DateTimeImmutable
```
Get when this event occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L58)
###### Returns
`DateTimeImmutable` — The timestamp when the event was created
##### getOperation
```php
public function getOperation(): string
```
Get the OpenFGA operation name.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php#L80)
###### Returns
`string` — The operation name (for example, 'check', 'write', 'read')
##### getPayload
```php
public function getPayload(): array
```
Get the event payload data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L67)
###### Returns
`array` — The event data
##### getResult
```php
public function getResult(): mixed
```
Get the result of the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php#L90)
###### Returns
`mixed` — The operation result (typically a Response object) or null if failed
##### getStoreId
```php
public function getStoreId(): string|null
```
Get the store ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php#L100)
###### Returns
`string` | `null` — The store ID or null if not applicable
##### isPropagationStopped
```php
public function isPropagationStopped(): bool
```
Check if event propagation should be stopped.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L76)
###### Returns
`bool` — True if propagation should be stopped
##### isSuccessful
```php
public function isSuccessful(): bool
```
Check if the operation completed successfully.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationCompletedEvent.php#L110)
###### Returns
`bool` — True if the operation succeeded, false otherwise
##### stopPropagation
```php
public function stopPropagation(): void
```
Stop event propagation to remaining listeners.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L85)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Events/OperationCompletedEvent.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/OperationStartedEvent.md -->
### OperationStartedEvent
Event fired when a high-level operation starts. This event tracks business operations like check, expand, writeTuples, etc.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getEventId()`](#geteventid)
- [`getEventType()`](#geteventtype)
- [`getModelId()`](#getmodelid)
- [`getOccurredAt()`](#getoccurredat)
- [`getOperation()`](#getoperation)
- [`getPayload()`](#getpayload)
- [`getStoreId()`](#getstoreid)
- [`isPropagationStopped()`](#ispropagationstopped)
- [`stopPropagation()`](#stoppropagation)
</details>
#### Namespace
`OpenFGA\Events`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationStartedEvent.php)
#### Implements
- [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/EventInterface.md)
#### Methods
##### getContext
```php
public function getContext(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationStartedEvent.php#L37)
###### Returns
`array<`string`, `mixed`>`
##### getEventId
```php
public function getEventId(): string
```
Get the unique identifier for this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L40)
###### Returns
`string` — A unique identifier for the event instance
##### getEventType
```php
public function getEventType(): string
```
Get the name/type of this event.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L49)
###### Returns
`string` — The event type identifier
##### getModelId
```php
public function getModelId(): string|null
```
Get the model ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationStartedEvent.php#L47)
###### Returns
`string` | `null` — The model ID or null if not applicable
##### getOccurredAt
```php
public function getOccurredAt(): DateTimeImmutable
```
Get when this event occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L58)
###### Returns
`DateTimeImmutable` — The timestamp when the event was created
##### getOperation
```php
public function getOperation(): string
```
Get the OpenFGA operation name.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationStartedEvent.php#L57)
###### Returns
`string` — The operation name (for example, 'check', 'write', 'read')
##### getPayload
```php
public function getPayload(): array
```
Get the event payload data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L67)
###### Returns
`array` — The event data
##### getStoreId
```php
public function getStoreId(): string|null
```
Get the store ID for the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/OperationStartedEvent.php#L67)
###### Returns
`string` | `null` — The store ID or null if not applicable
##### isPropagationStopped
```php
public function isPropagationStopped(): bool
```
Check if event propagation should be stopped.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L76)
###### Returns
`bool` — True if propagation should be stopped
##### stopPropagation
```php
public function stopPropagation(): void
```
Stop event propagation to remaining listeners.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Events/AbstractEvent.php#L85)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Events/OperationStartedEvent.md -->
<!-- Source: evansims/openfga-php/docs/API/Events/README.md -->
## Events
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Events
Event system for cross-cutting concerns like logging and metrics collection.
**Total Components:** 7
### Interfaces
| Name | Description |
|------|-------------|
| [`EventDispatcherInterface`](https://github.com/evansims/openfga-php/blob/main/./EventDispatcherInterface.md) | Event dispatcher interface for handling domain events. The event dispatcher decouples event publi... |
| [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/./EventInterface.md) | Base interface for all domain events. Events represent something significant that happened in the... |
### Classes
| Name | Description |
|------|-------------|
| [`EventDispatcher`](https://github.com/evansims/openfga-php/blob/main/./EventDispatcher.md) | Simple event dispatcher implementation. Manages event listeners and dispatches events to register... |
| [`HttpRequestSentEvent`](https://github.com/evansims/openfga-php/blob/main/./HttpRequestSentEvent.md) | Event fired when an HTTP request is sent to the OpenFGA API. This event contains the outgoing req... |
| [`HttpResponseReceivedEvent`](https://github.com/evansims/openfga-php/blob/main/./HttpResponseReceivedEvent.md) | Event fired when an HTTP response is received from the OpenFGA API. This event contains both the ... |
| [`OperationCompletedEvent`](https://github.com/evansims/openfga-php/blob/main/./OperationCompletedEvent.md) | Event fired when a high-level operation completes. This event tracks the completion of business o... |
| [`OperationStartedEvent`](https://github.com/evansims/openfga-php/blob/main/./OperationStartedEvent.md) | Event fired when a high-level operation starts. This event tracks business operations like check,... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Events/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/AuthenticationError.md -->
### AuthenticationError
Authentication error types for the OpenFGA SDK. Defines specific authentication failure scenarios that can occur when interacting with the OpenFGA API, such as expired or invalid tokens. Each case provides a factory method to create the corresponding AuthenticationException with appropriate context. Authentication errors typically occur during the OAuth 2.0 flow or when using access tokens with OpenFGA API requests. These errors indicate that the provided credentials are no longer valid or were never valid, requiring token refresh or re-authentication.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`exception()`](#exception)
- [`getUserMessage()`](#getusermessage)
- [`isTokenRefreshable()`](#istokenrefreshable)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/AuthenticationError.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| -------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TokenExpired` | `token_expired` | Access token has expired and needs to be refreshed. Occurs when an access token's expiration time has passed, requiring a new token to be obtained through the OAuth flow. |
| `TokenInvalid` | `token_invalid` | Access token is invalid or malformed. Occurs when the provided token is not recognized by the authorization server or has an invalid format. |
#### Cases
| Name | Value | Description |
| -------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TokenExpired` | `token_expired` | Access token has expired and needs to be refreshed. Occurs when an access token's expiration time has passed, requiring a new token to be obtained through the OAuth flow. |
| `TokenInvalid` | `token_invalid` | Access token is invalid or malformed. Occurs when the provided token is not recognized by the authorization server or has an invalid format. |
#### Methods
##### exception
```php
public function exception(
RequestInterface|null $request = NULL,
ResponseInterface|null $response = NULL,
array<string, mixed> $context = [],
Throwable|null $prev = NULL,
): AuthenticationException
```
Create a new AuthenticationException for this error type. Factory method that creates an AuthenticationException instance with the current error type and provided context information. This provides a convenient way to generate typed exceptions with proper error categorization and rich debugging context for OpenFGA authentication failures. The exception will automatically capture the correct file and line location where this method was called (typically where `throw` occurs), ensuring debuggers show the actual throw location rather than this factory method.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/AuthenticationError.php#L71)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | `null` | The PSR-7 HTTP request that triggered the authentication failure, if applicable |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` | The PSR-7 HTTP response containing authentication error details, if applicable |
| `$context` | `array<`string`, `mixed`>` | |
| `$prev` | `Throwable` | `null` | The previous throwable used for exception chaining, if any |
###### Returns
[`AuthenticationException`](https://github.com/evansims/openfga-php/blob/main/AuthenticationException.md) — The newly created AuthenticationException instance with comprehensive error context
##### getUserMessage
```php
public function getUserMessage(string|null $locale = NULL): string
```
Get a user-friendly error message for this authentication error. Provides appropriate messaging for different authentication failures that can be displayed to end users or used in error logs. Messages are localized using the translation system.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/AuthenticationError.php#L93)
###### Parameters
| Name | Type | Description |
| --------- | ---------------------- | ------------------------------------------------ |
| `$locale` | `string` | `null` | Optional locale override for message translation |
###### Returns
`string` — A descriptive, localized error message
##### isTokenRefreshable
```php
public function isTokenRefreshable(): bool
```
Check if this authentication error indicates the token should be refreshed. Useful for implementing automatic token refresh logic in OAuth flows.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/AuthenticationError.php#L110)
###### Returns
`bool` — True if token refresh should be attempted, false otherwise
<!-- End of evansims/openfga-php/docs/API/Exceptions/AuthenticationError.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/AuthenticationException.md -->
### AuthenticationException
Authentication-related exception for the OpenFGA SDK. Thrown when authentication failures occur, such as expired or invalid tokens. Provides detailed context about the authentication failure including the specific error type and any associated HTTP request/response information.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`context()`](#context)
- [`getCode()`](#getcode)
- [`getFile()`](#getfile)
- [`getLine()`](#getline)
- [`getMessage()`](#getmessage)
- [`getPrevious()`](#getprevious)
- [`getTrace()`](#gettrace)
- [`getTraceAsString()`](#gettraceasstring)
- [`kind()`](#kind)
- [`previous()`](#previous)
- [`request()`](#request)
- [`response()`](#response)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/AuthenticationException.php)
#### Implements
- `Stringable`
- `Throwable`
- [`ClientThrowable`](https://github.com/evansims/openfga-php/blob/main/ClientThrowable.md)
#### Methods
##### context
```php
public function context(): array<string, mixed>
```
Get additional context information about the exception. Provides access to contextual data that was available when the exception occurred, such as parameter values, configuration details, API response data, or other relevant debugging information. This context is essential for understanding the circumstances that led to the error and can be used for logging, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L32)
###### Returns
`array<`string`, `mixed`>` — Associative array of context data including parameter values, error details, and debugging information
##### getCode
```php
public function getCode()
```
##### getFile
```php
public function getFile(): string
```
###### Returns
`string`
##### getLine
```php
public function getLine(): int
```
###### Returns
`int`
##### getMessage
```php
public function getMessage(): string
```
###### Returns
`string`
##### getPrevious
```php
public function getPrevious(): ?Throwable
```
###### Returns
`Throwable` | `null`
##### getTrace
```php
public function getTrace(): array
```
###### Returns
`array`
##### getTraceAsString
```php
public function getTraceAsString(): string
```
###### Returns
`string`
##### kind
```php
public function kind(): OpenFGA\Exceptions\ClientError|OpenFGA\Exceptions\AuthenticationError|OpenFGA\Exceptions\ConfigurationError|OpenFGA\Exceptions\NetworkError|OpenFGA\Exceptions\SerializationError
```
Get the specific error category for this exception. Returns the error classification that indicates the general category of the problem (authentication, configuration, network, etc.), allowing for categorized error handling and reporting. This categorization helps applications implement appropriate retry logic, user messaging, and error recovery strategies based on the type of failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L40)
###### Returns
[`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) — The error category enum indicating the type of failure
##### previous
```php
public function previous(): ?Throwable
```
Get the previous exception that caused this one. Provides access to the exception chain for cases where this exception was triggered by another underlying exception. This maintains the full context of error propagation and is essential for root cause analysis when exceptions are wrapped or transformed during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L48)
###### Returns
`Throwable` | `null` — The previous exception in the chain, or null if this is the root exception
##### request
```php
public function request(): ?Psr\Http\Message\RequestInterface
```
Get the HTTP request associated with this exception. Returns the PSR-7 HTTP request that was being processed when this exception occurred. This is particularly useful for debugging API call failures, allowing developers to inspect the request URL, headers, body, and method that led to the error condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L56)
###### Returns
`Psr\Http\Message\RequestInterface` | `null` — The PSR-7 HTTP request that triggered the exception, or null if not applicable
##### response
```php
public function response(): ?Psr\Http\Message\ResponseInterface
```
Get the HTTP response associated with this exception. Returns the PSR-7 HTTP response that was received when this exception occurred, providing access to status codes, headers, and response body for debugging. This is especially valuable for understanding API-level failures and can contain detailed error messages from the OpenFGA service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L64)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null` — The PSR-7 HTTP response received from the API, or null if no response was received
<!-- End of evansims/openfga-php/docs/API/Exceptions/AuthenticationException.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/ClientError.md -->
### ClientError
General client error types for the OpenFGA SDK. Defines high-level error categories that can occur when using the SDK, providing a way to classify different types of failures such as authentication, configuration, network, serialization, and validation errors. Each case provides a factory method to create the corresponding ClientException. These error categories help applications implement appropriate error handling strategies, retry logic, and user messaging based on the type of failure: - Authentication: Token-related issues, expired credentials, OAuth failures - Configuration: Missing PSR components, invalid SDK setup, configuration errors - Network: HTTP communication failures, timeouts, API connectivity issues - Serialization: JSON parsing errors, schema validation failures, data format issues - Validation: Parameter validation failures, invalid API usage, constraint violations
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`exception()`](#exception)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientError.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| ---------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Authentication` | `authentication` | Authentication-related failures when communicating with OpenFGA. Includes token expiration, invalid credentials, OAuth flow failures, or other authentication mechanism issues. |
| `Configuration` | `configuration` | SDK configuration issues that prevent proper operation. Includes missing PSR HTTP components, invalid configuration parameters, or improper SDK setup that prevents API communication. |
| `Network` | `network` | Network and HTTP communication failures with the OpenFGA API. Includes connectivity issues, timeouts, HTTP errors, or other network-level problems that prevent successful API requests. |
| `Serialization` | `serialization` | Data serialization and deserialization failures. Includes JSON parsing errors, schema validation failures, data type conversion issues, or other data format problems. |
| `Validation` | `validation` | Parameter validation and API usage errors. Includes invalid parameter values, constraint violations, improper API usage, or other validation failures before sending requests. |
#### Cases
| Name | Value | Description |
| ---------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Authentication` | `authentication` | Authentication-related failures when communicating with OpenFGA. Includes token expiration, invalid credentials, OAuth flow failures, or other authentication mechanism issues. |
| `Configuration` | `configuration` | SDK configuration issues that prevent proper operation. Includes missing PSR HTTP components, invalid configuration parameters, or improper SDK setup that prevents API communication. |
| `Network` | `network` | Network and HTTP communication failures with the OpenFGA API. Includes connectivity issues, timeouts, HTTP errors, or other network-level problems that prevent successful API requests. |
| `Serialization` | `serialization` | Data serialization and deserialization failures. Includes JSON parsing errors, schema validation failures, data type conversion issues, or other data format problems. |
| `Validation` | `validation` | Parameter validation and API usage errors. Includes invalid parameter values, constraint violations, improper API usage, or other validation failures before sending requests. |
#### Methods
##### exception
```php
public function exception(
RequestInterface|null $request = NULL,
ResponseInterface|null $response = NULL,
array<string, mixed> $context = [],
Throwable|null $prev = NULL,
): ClientException
```
Create a new ClientException for this error type. Factory method that creates a ClientException instance with the current error type and provided context information. This provides a convenient way to generate typed exceptions with proper error categorization and rich debugging context for OpenFGA API failures. The exception will automatically capture the correct file and line location where this method was called (typically where `throw` occurs), ensuring debuggers show the actual throw location rather than this factory method.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientError.php#L98)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | `null` | The PSR-7 HTTP request that triggered the exception, if applicable |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` | The PSR-7 HTTP response received, if applicable |
| `$context` | `array<`string`, `mixed`>` | |
| `$prev` | `Throwable` | `null` | The previous throwable used for exception chaining, if any |
###### Returns
[`ClientException`](https://github.com/evansims/openfga-php/blob/main/ClientException.md) — The newly created ClientException instance with comprehensive error context
<!-- End of evansims/openfga-php/docs/API/Exceptions/ClientError.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/ClientException.md -->
### ClientException
General client exception for the OpenFGA SDK. Thrown for high-level client errors that can be categorized into different types such as authentication, configuration, network, serialization, or validation failures. Provides detailed context about the failure including the specific error category and any associated HTTP information.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`context()`](#context)
- [`getCode()`](#getcode)
- [`getFile()`](#getfile)
- [`getLine()`](#getline)
- [`getMessage()`](#getmessage)
- [`getPrevious()`](#getprevious)
- [`getTrace()`](#gettrace)
- [`getTraceAsString()`](#gettraceasstring)
- [`kind()`](#kind)
- [`previous()`](#previous)
- [`request()`](#request)
- [`response()`](#response)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientException.php)
#### Implements
- `Stringable`
- `Throwable`
- [`ClientThrowable`](https://github.com/evansims/openfga-php/blob/main/ClientThrowable.md)
#### Methods
##### context
```php
public function context(): array<string, mixed>
```
Get additional context information about the exception. Provides access to contextual data that was available when the exception occurred, such as parameter values, configuration details, API response data, or other relevant debugging information. This context is essential for understanding the circumstances that led to the error and can be used for logging, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L32)
###### Returns
`array<`string`, `mixed`>` — Associative array of context data including parameter values, error details, and debugging information
##### getCode
```php
public function getCode()
```
##### getFile
```php
public function getFile(): string
```
###### Returns
`string`
##### getLine
```php
public function getLine(): int
```
###### Returns
`int`
##### getMessage
```php
public function getMessage(): string
```
###### Returns
`string`
##### getPrevious
```php
public function getPrevious(): ?Throwable
```
###### Returns
`Throwable` | `null`
##### getTrace
```php
public function getTrace(): array
```
###### Returns
`array`
##### getTraceAsString
```php
public function getTraceAsString(): string
```
###### Returns
`string`
##### kind
```php
public function kind(): OpenFGA\Exceptions\ClientError|OpenFGA\Exceptions\AuthenticationError|OpenFGA\Exceptions\ConfigurationError|OpenFGA\Exceptions\NetworkError|OpenFGA\Exceptions\SerializationError
```
Get the specific error category for this exception. Returns the error classification that indicates the general category of the problem (authentication, configuration, network, etc.), allowing for categorized error handling and reporting. This categorization helps applications implement appropriate retry logic, user messaging, and error recovery strategies based on the type of failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L40)
###### Returns
[`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) — The error category enum indicating the type of failure
##### previous
```php
public function previous(): ?Throwable
```
Get the previous exception that caused this one. Provides access to the exception chain for cases where this exception was triggered by another underlying exception. This maintains the full context of error propagation and is essential for root cause analysis when exceptions are wrapped or transformed during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L48)
###### Returns
`Throwable` | `null` — The previous exception in the chain, or null if this is the root exception
##### request
```php
public function request(): ?Psr\Http\Message\RequestInterface
```
Get the HTTP request associated with this exception. Returns the PSR-7 HTTP request that was being processed when this exception occurred. This is particularly useful for debugging API call failures, allowing developers to inspect the request URL, headers, body, and method that led to the error condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L56)
###### Returns
`Psr\Http\Message\RequestInterface` | `null` — The PSR-7 HTTP request that triggered the exception, or null if not applicable
##### response
```php
public function response(): ?Psr\Http\Message\ResponseInterface
```
Get the HTTP response associated with this exception. Returns the PSR-7 HTTP response that was received when this exception occurred, providing access to status codes, headers, and response body for debugging. This is especially valuable for understanding API-level failures and can contain detailed error messages from the OpenFGA service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L64)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null` — The PSR-7 HTTP response received from the API, or null if no response was received
<!-- End of evansims/openfga-php/docs/API/Exceptions/ClientException.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/ClientThrowable.md -->
### ClientThrowable
Base interface for all OpenFGA SDK exceptions. Extends the standard PHP Throwable interface with additional methods to provide detailed context about SDK-specific errors including HTTP request/response information and categorized error types. This interface ensures consistent error handling across all exception types in the OpenFGA SDK, enabling developers to access rich context information for debugging and error reporting. All OpenFGA exceptions implement this interface to provide a unified error handling experience. OpenFGA exceptions are categorized into specific types: - Authentication errors (token expired, invalid credentials) - Configuration errors (missing PSR components, invalid setup) - Network errors (HTTP failures, timeouts, API unavailability) - Serialization errors (JSON parsing, schema validation failures) - Client errors (general validation and usage errors)
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`context()`](#context)
- [`getCode()`](#getcode)
- [`getFile()`](#getfile)
- [`getLine()`](#getline)
- [`getMessage()`](#getmessage)
- [`getPrevious()`](#getprevious)
- [`getTrace()`](#gettrace)
- [`getTraceAsString()`](#gettraceasstring)
- [`kind()`](#kind)
- [`previous()`](#previous)
- [`request()`](#request)
- [`response()`](#response)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientThrowable.php)
#### Implements
- `Throwable`
- `Stringable`
#### Methods
##### context
```php
public function context(): array<string, mixed>
```
Get additional context information about the exception. Provides access to contextual data that was available when the exception occurred, such as parameter values, configuration details, API response data, or other relevant debugging information. This context is essential for understanding the circumstances that led to the error and can be used for logging, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientThrowable.php#L45)
###### Returns
`array<`string`, `mixed`>` — Associative array of context data including parameter values, error details, and debugging information
##### getCode
```php
public function getCode()
```
##### getFile
```php
public function getFile(): string
```
###### Returns
`string`
##### getLine
```php
public function getLine(): int
```
###### Returns
`int`
##### getMessage
```php
public function getMessage(): string
```
###### Returns
`string`
##### getPrevious
```php
public function getPrevious(): ?Throwable
```
###### Returns
`Throwable` | `null`
##### getTrace
```php
public function getTrace(): array
```
###### Returns
`array`
##### getTraceAsString
```php
public function getTraceAsString(): string
```
###### Returns
`string`
##### kind
```php
public function kind(): AuthenticationError|ClientError|ConfigurationError|NetworkError|SerializationError
```
Get the specific error category for this exception. Returns the error classification that indicates the general category of the problem (authentication, configuration, network, etc.), allowing for categorized error handling and reporting. This categorization helps applications implement appropriate retry logic, user messaging, and error recovery strategies based on the type of failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientThrowable.php#L58)
###### Returns
[`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | [`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) — The error category enum indicating the type of failure
##### previous
```php
public function previous(): Throwable|null
```
Get the previous exception that caused this one. Provides access to the exception chain for cases where this exception was triggered by another underlying exception. This maintains the full context of error propagation and is essential for root cause analysis when exceptions are wrapped or transformed during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientThrowable.php#L70)
###### Returns
`Throwable` | `null` — The previous exception in the chain, or null if this is the root exception
##### request
```php
public function request(): RequestInterface|null
```
Get the HTTP request associated with this exception. Returns the PSR-7 HTTP request that was being processed when this exception occurred. This is particularly useful for debugging API call failures, allowing developers to inspect the request URL, headers, body, and method that led to the error condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientThrowable.php#L82)
###### Returns
[`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | `null` — The PSR-7 HTTP request that triggered the exception, or null if not applicable
##### response
```php
public function response(): ResponseInterface|null
```
Get the HTTP response associated with this exception. Returns the PSR-7 HTTP response that was received when this exception occurred, providing access to status codes, headers, and response body for debugging. This is especially valuable for understanding API-level failures and can contain detailed error messages from the OpenFGA service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ClientThrowable.php#L94)
###### Returns
[`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` — The PSR-7 HTTP response received from the API, or null if no response was received
<!-- End of evansims/openfga-php/docs/API/Exceptions/ClientThrowable.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/ConfigurationError.md -->
### ConfigurationError
Configuration error types for the OpenFGA SDK. Defines specific configuration-related failures that can occur when setting up or using the SDK, typically related to missing required PSR HTTP components or invalid configuration parameters. Each case provides a factory method to create the corresponding ConfigurationException. Configuration errors usually occur during SDK initialization when required dependencies are missing or improperly configured. These errors indicate that the SDK cannot operate properly due to missing PSR-7/PSR-17/PSR-18 components or invalid configuration settings.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`exception()`](#exception)
- [`getRequiredPsrInterface()`](#getrequiredpsrinterface)
- [`isHttpComponentMissing()`](#ishttpcomponentmissing)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ConfigurationError.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| ---------------------------- | ------------------------------- | ----------- |
| `HttpClientMissing` | `http_client_missing` | |
| `HttpRequestFactoryMissing` | `http_request_factory_missing` | |
| `HttpResponseFactoryMissing` | `http_response_factory_missing` | |
| `HttpStreamFactoryMissing` | `http_stream_factory_missing` | |
| `InvalidLanguage` | `invalid_language` | |
| `InvalidRetryCount` | `invalid_retry_count` | |
| `InvalidUrl` | `invalid_url` | |
#### Cases
| Name | Value | Description |
| ---------------------------- | ------------------------------- | ----------- |
| `HttpClientMissing` | `http_client_missing` | |
| `HttpRequestFactoryMissing` | `http_request_factory_missing` | |
| `HttpResponseFactoryMissing` | `http_response_factory_missing` | |
| `HttpStreamFactoryMissing` | `http_stream_factory_missing` | |
| `InvalidLanguage` | `invalid_language` | |
| `InvalidRetryCount` | `invalid_retry_count` | |
| `InvalidUrl` | `invalid_url` | |
#### Methods
##### exception
```php
public function exception(
RequestInterface|null $request = NULL,
ResponseInterface|null $response = NULL,
array<string, mixed> $context = [],
Throwable|null $prev = NULL,
): ConfigurationException
```
Create a new ConfigurationException for this error type. Factory method that creates a ConfigurationException instance with the current error type and provided context information. This provides a convenient way to generate typed exceptions with proper error categorization and rich debugging context for OpenFGA configuration failures. The exception will automatically capture the correct file and line location where this method was called (typically where `throw` occurs), ensuring debuggers show the actual throw location rather than this factory method.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ConfigurationError.php#L68)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | `null` | The PSR-7 HTTP request being processed when configuration error occurred, if applicable |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` | The PSR-7 HTTP response received, if applicable |
| `$context` | `array<`string`, `mixed`>` | |
| `$prev` | `Throwable` | `null` | The previous throwable used for exception chaining, if any |
###### Returns
[`ConfigurationException`](https://github.com/evansims/openfga-php/blob/main/ConfigurationException.md) — The newly created ConfigurationException instance with comprehensive error context
##### getRequiredPsrInterface
```php
public function getRequiredPsrInterface(): string
```
Get the recommended PSR interface for this configuration error. Provides the specific PSR interface name that should be implemented to resolve this configuration error, useful for error messages and documentation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ConfigurationError.php#L88)
###### Returns
`string` — The PSR interface name
##### isHttpComponentMissing
```php
public function isHttpComponentMissing(): bool
```
Check if this configuration error is related to missing PSR HTTP components. Useful for providing specific error handling and setup guidance when PSR HTTP dependencies are not properly configured.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ConfigurationError.php#L109)
###### Returns
`bool` — True if the error is related to missing HTTP components, false otherwise
<!-- End of evansims/openfga-php/docs/API/Exceptions/ConfigurationError.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/ConfigurationException.md -->
### ConfigurationException
Configuration-related exception for the OpenFGA SDK. Thrown when configuration errors occur, typically related to missing or invalid PSR HTTP components required for SDK operation. Provides detailed context about the configuration failure and guidance for resolution.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`context()`](#context)
- [`getCode()`](#getcode)
- [`getFile()`](#getfile)
- [`getLine()`](#getline)
- [`getMessage()`](#getmessage)
- [`getPrevious()`](#getprevious)
- [`getTrace()`](#gettrace)
- [`getTraceAsString()`](#gettraceasstring)
- [`kind()`](#kind)
- [`previous()`](#previous)
- [`request()`](#request)
- [`response()`](#response)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ConfigurationException.php)
#### Implements
- `Stringable`
- `Throwable`
- [`ClientThrowable`](https://github.com/evansims/openfga-php/blob/main/ClientThrowable.md)
#### Methods
##### context
```php
public function context(): array<string, mixed>
```
Get additional context information about the exception. Provides access to contextual data that was available when the exception occurred, such as parameter values, configuration details, API response data, or other relevant debugging information. This context is essential for understanding the circumstances that led to the error and can be used for logging, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L32)
###### Returns
`array<`string`, `mixed`>` — Associative array of context data including parameter values, error details, and debugging information
##### getCode
```php
public function getCode()
```
##### getFile
```php
public function getFile(): string
```
###### Returns
`string`
##### getLine
```php
public function getLine(): int
```
###### Returns
`int`
##### getMessage
```php
public function getMessage(): string
```
###### Returns
`string`
##### getPrevious
```php
public function getPrevious(): ?Throwable
```
###### Returns
`Throwable` | `null`
##### getTrace
```php
public function getTrace(): array
```
###### Returns
`array`
##### getTraceAsString
```php
public function getTraceAsString(): string
```
###### Returns
`string`
##### kind
```php
public function kind(): OpenFGA\Exceptions\ClientError|OpenFGA\Exceptions\AuthenticationError|OpenFGA\Exceptions\ConfigurationError|OpenFGA\Exceptions\NetworkError|OpenFGA\Exceptions\SerializationError
```
Get the specific error category for this exception. Returns the error classification that indicates the general category of the problem (authentication, configuration, network, etc.), allowing for categorized error handling and reporting. This categorization helps applications implement appropriate retry logic, user messaging, and error recovery strategies based on the type of failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L40)
###### Returns
[`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) — The error category enum indicating the type of failure
##### previous
```php
public function previous(): ?Throwable
```
Get the previous exception that caused this one. Provides access to the exception chain for cases where this exception was triggered by another underlying exception. This maintains the full context of error propagation and is essential for root cause analysis when exceptions are wrapped or transformed during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L48)
###### Returns
`Throwable` | `null` — The previous exception in the chain, or null if this is the root exception
##### request
```php
public function request(): ?Psr\Http\Message\RequestInterface
```
Get the HTTP request associated with this exception. Returns the PSR-7 HTTP request that was being processed when this exception occurred. This is particularly useful for debugging API call failures, allowing developers to inspect the request URL, headers, body, and method that led to the error condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L56)
###### Returns
`Psr\Http\Message\RequestInterface` | `null` — The PSR-7 HTTP request that triggered the exception, or null if not applicable
##### response
```php
public function response(): ?Psr\Http\Message\ResponseInterface
```
Get the HTTP response associated with this exception. Returns the PSR-7 HTTP response that was received when this exception occurred, providing access to status codes, headers, and response body for debugging. This is especially valuable for understanding API-level failures and can contain detailed error messages from the OpenFGA service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L64)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null` — The PSR-7 HTTP response received from the API, or null if no response was received
<!-- End of evansims/openfga-php/docs/API/Exceptions/ConfigurationException.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/DefaultMessages.md -->
### DefaultMessages
Maps exception error enums to their default message keys. This class provides the concrete implementation for mapping various error enum types to their corresponding translation message keys. It maintains comprehensive mappings for all error categories in the OpenFGA SDK, enabling consistent and translatable error messages. The class uses static arrays to maintain mappings between error enum values and message keys, providing fast lookup performance while keeping the mappings centralized and maintainable. Each error category has its own mapping array and corresponding method for type-safe access. Error categories supported: - Authentication errors: Token expiration, invalid credentials - Client errors: General validation and usage failures - Configuration errors: Missing PSR components, setup issues - Network errors: HTTP failures, timeouts, connectivity issues - Serialization errors: JSON parsing, schema validation failures
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`forAuthenticationError()`](#forauthenticationerror)
- [`forClientError()`](#forclienterror)
- [`forConfigurationError()`](#forconfigurationerror)
- [`forError()`](#forerror)
- [`forNetworkError()`](#fornetworkerror)
- [`forSerializationError()`](#forserializationerror)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessages.php)
#### Implements
- [`DefaultMessagesInterface`](https://github.com/evansims/openfga-php/blob/main/DefaultMessagesInterface.md)
#### Related Classes
- [DefaultMessagesInterface](https://github.com/evansims/openfga-php/blob/main/Exceptions/DefaultMessagesInterface.md) (interface)
#### Methods
##### forAuthenticationError
*<small>Implements Exceptions\DefaultMessagesInterface</small>*
```php
public function forAuthenticationError(AuthenticationError $error): Messages
```
Get the default message key for an authentication error. Maps authentication-related error types (such as expired tokens or invalid credentials) to their corresponding message keys. These messages typically guide users on how to resolve authentication issues with the OpenFGA service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessagesInterface.php#L40)
###### Parameters
| Name | Type | Description |
| -------- | ----------------------------------------------- | ---------------------------------------------------- |
| `$error` | [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | The specific authentication error type that occurred |
###### Returns
[`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) — The corresponding message enum case for translation
##### forClientError
*<small>Implements Exceptions\DefaultMessagesInterface</small>*
```php
public function forClientError(ClientError $error): Messages
```
Get the default message key for a general client error. Maps high-level client error categories to their corresponding message keys. These are broad error classifications that encompass various types of SDK usage and operational failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessagesInterface.php#L52)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------- | -------------------------------------------- |
| `$error` | [`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | The specific client error type that occurred |
###### Returns
[`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) — The corresponding message enum case for translation
##### forConfigurationError
*<small>Implements Exceptions\DefaultMessagesInterface</small>*
```php
public function forConfigurationError(ConfigurationError $error): Messages
```
Get the default message key for a configuration error. Maps configuration-related error types (such as missing PSR components or invalid setup) to their corresponding message keys. These messages typically provide guidance on proper SDK configuration and setup.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessagesInterface.php#L64)
###### Parameters
| Name | Type | Description |
| -------- | --------------------------------------------- | --------------------------------------------------- |
| `$error` | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | The specific configuration error type that occurred |
###### Returns
[`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) — The corresponding message enum case for translation
##### forError
*<small>Implements Exceptions\DefaultMessagesInterface</small>*
```php
public function forError(
AuthenticationError|ClientError|ConfigurationError|NetworkError|SerializationError $error,
): Messages
```
Get the default message key for any supported error type. Generic method that accepts any error enum type and routes it to the appropriate specific method. This provides a unified interface for error message lookup when the specific error type is not known at compile time.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessagesInterface.php#L77)
###### Parameters
| Name | Type | Description |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| `$error` | [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | [`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) | The error enum of any supported type |
###### Returns
[`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) — The corresponding message enum case for translation
##### forNetworkError
*<small>Implements Exceptions\DefaultMessagesInterface</small>*
```php
public function forNetworkError(NetworkError $error): Messages
```
Get the default message key for a network error. Maps network and HTTP-related error types (such as timeouts, HTTP status codes, or connectivity issues) to their corresponding message keys. These messages often include information about retry strategies and network troubleshooting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessagesInterface.php#L90)
###### Parameters
| Name | Type | Description |
| -------- | --------------------------------- | --------------------------------------------- |
| `$error` | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | The specific network error type that occurred |
###### Returns
[`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) — The corresponding message enum case for translation
##### forSerializationError
*<small>Implements Exceptions\DefaultMessagesInterface</small>*
```php
public function forSerializationError(SerializationError $error): Messages
```
Get the default message key for a serialization error. Maps data serialization and validation error types (such as JSON parsing failures or schema validation errors) to their corresponding message keys. These messages typically provide details about data format issues and validation failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessagesInterface.php#L103)
###### Parameters
| Name | Type | Description |
| -------- | --------------------------------------------- | --------------------------------------------------- |
| `$error` | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) | The specific serialization error type that occurred |
###### Returns
[`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) — The corresponding message enum case for translation
<!-- End of evansims/openfga-php/docs/API/Exceptions/DefaultMessages.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/DefaultMessagesInterface.md -->
### DefaultMessagesInterface
Interface for mapping exception error enums to their default message keys. Provides a contract for retrieving default translation message keys for various types of exceptions in the OpenFGA SDK. This interface enables consistent error messaging across the SDK by centralizing the mapping between error types and their corresponding human-readable messages, supporting internationalization and localization. The interface handles all major error categories in the OpenFGA SDK: authentication, client, configuration, network, and serialization errors. Each method returns a Messages enum that can be used with the translation system to generate localized error messages.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/DefaultMessagesInterface.php)
#### Related Classes
- [DefaultMessages](https://github.com/evansims/openfga-php/blob/main/Exceptions/DefaultMessages.md) (implementation)
<!-- End of evansims/openfga-php/docs/API/Exceptions/DefaultMessagesInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/NetworkError.md -->
### NetworkError
Network error types for the OpenFGA SDK. Defines specific network and HTTP-related failures that can occur when communicating with the OpenFGA API, including HTTP status code errors, request failures, and timeouts. Each case provides a factory method to create the corresponding NetworkException. Network errors represent failures in HTTP communication with the OpenFGA service, ranging from client-side request errors to server-side failures. These errors often contain valuable debugging information in the HTTP response, including error messages and suggested remediation steps.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`exception()`](#exception)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/NetworkError.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Conflict` | `http_409` | HTTP 409 Conflict - Resource conflicts with current state. Indicates that the request conflicts with the current state of the target resource, often due to concurrent modifications. |
| `Forbidden` | `http_403` | HTTP 403 Forbidden - Access denied to the requested resource. The server understood the request but refuses to authorize it, typically due to insufficient permissions. |
| `Invalid` | `http_400` | HTTP 400 Bad Request - Invalid request format or parameters. The server cannot process the request due to malformed syntax, invalid parameters, or missing required data. |
| `Request` | `request_failed` | General request failure not related to HTTP status codes. Represents network-level failures such as DNS resolution errors, connection timeouts, or other transport-level issues. |
| `Server` | `http_500` | HTTP 500 Internal Server Error - Server-side processing failure. Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. |
| `Timeout` | `http_422` | HTTP 422 Unprocessable Entity - Request timeout or processing limit exceeded. The server understands the request but cannot process it due to timeout constraints or processing limits being exceeded. |
| `Unauthenticated` | `http_401` | HTTP 401 Unauthorized - Authentication required or failed. The request requires valid authentication credentials that were not provided or are no longer valid. |
| `UndefinedEndpoint` | `http_404` | HTTP 404 Not Found - Requested endpoint or resource does not exist. The server cannot find the requested resource, which may indicate an invalid API endpoint or a resource that has been deleted. |
| `Unexpected` | `unexpected` | Unexpected network error that doesn't fit other categories. Represents unusual network conditions or errors that are not covered by the standard HTTP status code categories. |
#### Cases
| Name | Value | Description |
| ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Conflict` | `http_409` | HTTP 409 Conflict - Resource conflicts with current state. Indicates that the request conflicts with the current state of the target resource, often due to concurrent modifications. |
| `Forbidden` | `http_403` | HTTP 403 Forbidden - Access denied to the requested resource. The server understood the request but refuses to authorize it, typically due to insufficient permissions. |
| `Invalid` | `http_400` | HTTP 400 Bad Request - Invalid request format or parameters. The server cannot process the request due to malformed syntax, invalid parameters, or missing required data. |
| `Request` | `request_failed` | General request failure not related to HTTP status codes. Represents network-level failures such as DNS resolution errors, connection timeouts, or other transport-level issues. |
| `Server` | `http_500` | HTTP 500 Internal Server Error - Server-side processing failure. Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. |
| `Timeout` | `http_422` | HTTP 422 Unprocessable Entity - Request timeout or processing limit exceeded. The server understands the request but cannot process it due to timeout constraints or processing limits being exceeded. |
| `Unauthenticated` | `http_401` | HTTP 401 Unauthorized - Authentication required or failed. The request requires valid authentication credentials that were not provided or are no longer valid. |
| `UndefinedEndpoint` | `http_404` | HTTP 404 Not Found - Requested endpoint or resource does not exist. The server cannot find the requested resource, which may indicate an invalid API endpoint or a resource that has been deleted. |
| `Unexpected` | `unexpected` | Unexpected network error that doesn't fit other categories. Represents unusual network conditions or errors that are not covered by the standard HTTP status code categories. |
#### Methods
##### exception
```php
public function exception(
RequestInterface|null $request = NULL,
ResponseInterface|null $response = NULL,
array<string, mixed> $context = [],
Throwable|null $prev = NULL,
): NetworkException
```
Create a new NetworkException for this error type. Factory method that creates a NetworkException instance with the current error type and provided context information. This provides a convenient way to generate typed exceptions with proper error categorization and rich debugging context for OpenFGA network failures. The exception will automatically capture the correct file and line location where this method was called (typically where `throw` occurs), ensuring debuggers show the actual throw location rather than this factory method.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/NetworkError.php#L126)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | `null` | The PSR-7 HTTP request that triggered the network failure, if applicable |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` | The PSR-7 HTTP response containing error details, if applicable |
| `$context` | `array<`string`, `mixed`>` | |
| `$prev` | `Throwable` | `null` | The previous throwable used for exception chaining, if any |
###### Returns
[`NetworkException`](https://github.com/evansims/openfga-php/blob/main/NetworkException.md) — The newly created NetworkException instance with comprehensive error context
<!-- End of evansims/openfga-php/docs/API/Exceptions/NetworkError.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/NetworkException.md -->
### NetworkException
Network-related exception for the OpenFGA SDK. Thrown when network or HTTP communication errors occur while interacting with the OpenFGA API. Includes specific HTTP status code errors, request failures, timeouts, and other network-related issues. Provides access to both the HTTP request and response for detailed debugging.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`context()`](#context)
- [`getCode()`](#getcode)
- [`getFile()`](#getfile)
- [`getLine()`](#getline)
- [`getMessage()`](#getmessage)
- [`getPrevious()`](#getprevious)
- [`getTrace()`](#gettrace)
- [`getTraceAsString()`](#gettraceasstring)
- [`kind()`](#kind)
- [`previous()`](#previous)
- [`request()`](#request)
- [`response()`](#response)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/NetworkException.php)
#### Implements
- `Stringable`
- `Throwable`
- [`ClientThrowable`](https://github.com/evansims/openfga-php/blob/main/ClientThrowable.md)
#### Methods
##### context
```php
public function context(): array<string, mixed>
```
Get additional context information about the exception. Provides access to contextual data that was available when the exception occurred, such as parameter values, configuration details, API response data, or other relevant debugging information. This context is essential for understanding the circumstances that led to the error and can be used for logging, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L32)
###### Returns
`array<`string`, `mixed`>` — Associative array of context data including parameter values, error details, and debugging information
##### getCode
```php
public function getCode()
```
##### getFile
```php
public function getFile(): string
```
###### Returns
`string`
##### getLine
```php
public function getLine(): int
```
###### Returns
`int`
##### getMessage
```php
public function getMessage(): string
```
###### Returns
`string`
##### getPrevious
```php
public function getPrevious(): ?Throwable
```
###### Returns
`Throwable` | `null`
##### getTrace
```php
public function getTrace(): array
```
###### Returns
`array`
##### getTraceAsString
```php
public function getTraceAsString(): string
```
###### Returns
`string`
##### kind
```php
public function kind(): OpenFGA\Exceptions\ClientError|OpenFGA\Exceptions\AuthenticationError|OpenFGA\Exceptions\ConfigurationError|OpenFGA\Exceptions\NetworkError|OpenFGA\Exceptions\SerializationError
```
Get the specific error category for this exception. Returns the error classification that indicates the general category of the problem (authentication, configuration, network, etc.), allowing for categorized error handling and reporting. This categorization helps applications implement appropriate retry logic, user messaging, and error recovery strategies based on the type of failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L40)
###### Returns
[`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) — The error category enum indicating the type of failure
##### previous
```php
public function previous(): ?Throwable
```
Get the previous exception that caused this one. Provides access to the exception chain for cases where this exception was triggered by another underlying exception. This maintains the full context of error propagation and is essential for root cause analysis when exceptions are wrapped or transformed during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L48)
###### Returns
`Throwable` | `null` — The previous exception in the chain, or null if this is the root exception
##### request
```php
public function request(): ?Psr\Http\Message\RequestInterface
```
Get the HTTP request associated with this exception. Returns the PSR-7 HTTP request that was being processed when this exception occurred. This is particularly useful for debugging API call failures, allowing developers to inspect the request URL, headers, body, and method that led to the error condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L56)
###### Returns
`Psr\Http\Message\RequestInterface` | `null` — The PSR-7 HTTP request that triggered the exception, or null if not applicable
##### response
```php
public function response(): ?Psr\Http\Message\ResponseInterface
```
Get the HTTP response associated with this exception. Returns the PSR-7 HTTP response that was received when this exception occurred, providing access to status codes, headers, and response body for debugging. This is especially valuable for understanding API-level failures and can contain detailed error messages from the OpenFGA service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L64)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null` — The PSR-7 HTTP response received from the API, or null if no response was received
<!-- End of evansims/openfga-php/docs/API/Exceptions/NetworkException.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/README.md -->
## Exceptions
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Exceptions
Exception hierarchy for type-safe error handling throughout the SDK.
**Total Components:** 13
### Interfaces
| Name | Description |
|------|-------------|
| [`ClientThrowable`](https://github.com/evansims/openfga-php/blob/main/./ClientThrowable.md) | Base interface for all OpenFGA SDK exceptions. Extends the standard PHP Throwable interface with ... |
| [`DefaultMessagesInterface`](https://github.com/evansims/openfga-php/blob/main/./DefaultMessagesInterface.md) | Interface for mapping exception error enums to their default message keys. Provides a contract fo... |
### Classes
| Name | Description |
|------|-------------|
| [`AuthenticationException`](https://github.com/evansims/openfga-php/blob/main/./AuthenticationException.md) | Authentication-related exception for the OpenFGA SDK. Thrown when authentication failures occur, ... |
| [`ClientException`](https://github.com/evansims/openfga-php/blob/main/./ClientException.md) | General client exception for the OpenFGA SDK. Thrown for high-level client errors that can be cat... |
| [`ConfigurationException`](https://github.com/evansims/openfga-php/blob/main/./ConfigurationException.md) | Configuration-related exception for the OpenFGA SDK. Thrown when configuration errors occur, typi... |
| [`DefaultMessages`](https://github.com/evansims/openfga-php/blob/main/./DefaultMessages.md) | Maps exception error enums to their default message keys. This class provides the concrete implem... |
| [`NetworkException`](https://github.com/evansims/openfga-php/blob/main/./NetworkException.md) | Network-related exception for the OpenFGA SDK. Thrown when network or HTTP communication errors o... |
| [`SerializationException`](https://github.com/evansims/openfga-php/blob/main/./SerializationException.md) | Serialization-related exception for the OpenFGA SDK. Thrown when data serialization, deserializat... |
### Enumerations
| Name | Description |
|------|-------------|
| [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/./AuthenticationError.md) | Authentication error types for the OpenFGA SDK. Defines specific authentication failure scenarios... |
| [`ClientError`](https://github.com/evansims/openfga-php/blob/main/./ClientError.md) | General client error types for the OpenFGA SDK. Defines high-level error categories that can occu... |
| [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/./ConfigurationError.md) | Configuration error types for the OpenFGA SDK. Defines specific configuration-related failures th... |
| [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/./NetworkError.md) | Network error types for the OpenFGA SDK. Defines specific network and HTTP-related failures that ... |
| [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/./SerializationError.md) | Serialization error types for the OpenFGA SDK. Defines specific serialization and data processing... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Exceptions/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/SerializationError.md -->
### SerializationError
Serialization error types for the OpenFGA SDK. Defines specific serialization and data processing failures that can occur when converting between different data formats (JSON, objects, etc.) or when validating data structures. Each case provides a factory method to create the corresponding SerializationException. Serialization errors typically occur during data transformation between JSON and PHP objects, schema validation, or when processing API responses. These errors often indicate data format mismatches, missing required fields, or type conversion failures that prevent proper object construction.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`exception()`](#exception)
- [`isCollectionError()`](#iscollectionerror)
- [`isTypeValidationError()`](#istypevalidationerror)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/SerializationError.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| ------------------------------------- | ---------------------------------------- | ----------- |
| `CouldNotAddItemsToCollection` | `could_not_add_items_to_collection` | |
| `EmptyCollection` | `empty_collection` | |
| `InvalidItemType` | `invalid_item_type` | |
| `MissingRequiredConstructorParameter` | `missing_required_constructor_parameter` | |
| `Response` | `response` | |
| `UndefinedItemType` | `undefined_item_type` | |
#### Cases
| Name | Value | Description |
| ------------------------------------- | ---------------------------------------- | ----------- |
| `CouldNotAddItemsToCollection` | `could_not_add_items_to_collection` | |
| `EmptyCollection` | `empty_collection` | |
| `InvalidItemType` | `invalid_item_type` | |
| `MissingRequiredConstructorParameter` | `missing_required_constructor_parameter` | |
| `Response` | `response` | |
| `UndefinedItemType` | `undefined_item_type` | |
#### Methods
##### exception
```php
public function exception(
RequestInterface|null $request = NULL,
ResponseInterface|null $response = NULL,
array<string, mixed> $context = [],
Throwable|null $prev = NULL,
): SerializationException
```
Create a new SerializationException for this error type. Factory method that creates a SerializationException instance with the current error type and provided context information. This provides a convenient way to generate typed exceptions with proper error categorization and rich debugging context for OpenFGA serialization failures. The exception will automatically capture the correct file and line location where this method was called (typically where `throw` occurs), ensuring debuggers show the actual throw location rather than this factory method.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/SerializationError.php#L66)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | `null` | The PSR-7 HTTP request being processed when serialization failed, if applicable |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` | The PSR-7 HTTP response containing invalid data, if applicable |
| `$context` | `array<`string`, `mixed`>` | |
| `$prev` | `Throwable` | `null` | The previous throwable used for exception chaining, if any |
###### Returns
[`SerializationException`](https://github.com/evansims/openfga-php/blob/main/SerializationException.md) — The newly created SerializationException instance with comprehensive error context
##### isCollectionError
```php
public function isCollectionError(): bool
```
Check if this serialization error is related to collection operations. Useful for identifying errors that occur during collection manipulation and providing appropriate error handling strategies.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/SerializationError.php#L86)
###### Returns
`bool` — True if the error is collection-related, false otherwise
##### isTypeValidationError
```php
public function isTypeValidationError(): bool
```
Check if this serialization error indicates a data type validation failure. Useful for distinguishing between validation errors and structural errors during serialization processes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/SerializationError.php#L106)
###### Returns
`bool` — True if the error is type-related, false otherwise
<!-- End of evansims/openfga-php/docs/API/Exceptions/SerializationError.md -->
<!-- Source: evansims/openfga-php/docs/API/Exceptions/SerializationException.md -->
### SerializationException
Serialization-related exception for the OpenFGA SDK. Thrown when data serialization, deserialization, or validation errors occur while processing API requests and responses. This includes JSON parsing failures, schema validation errors, and data type conversion issues. Provides detailed context about the serialization failure.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`context()`](#context)
- [`getCode()`](#getcode)
- [`getFile()`](#getfile)
- [`getLine()`](#getline)
- [`getMessage()`](#getmessage)
- [`getPrevious()`](#getprevious)
- [`getTrace()`](#gettrace)
- [`getTraceAsString()`](#gettraceasstring)
- [`kind()`](#kind)
- [`previous()`](#previous)
- [`request()`](#request)
- [`response()`](#response)
</details>
#### Namespace
`OpenFGA\Exceptions`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/SerializationException.php)
#### Implements
- `Stringable`
- `Throwable`
- [`ClientThrowable`](https://github.com/evansims/openfga-php/blob/main/ClientThrowable.md)
#### Methods
##### context
```php
public function context(): array<string, mixed>
```
Get additional context information about the exception. Provides access to contextual data that was available when the exception occurred, such as parameter values, configuration details, API response data, or other relevant debugging information. This context is essential for understanding the circumstances that led to the error and can be used for logging, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L32)
###### Returns
`array<`string`, `mixed`>` — Associative array of context data including parameter values, error details, and debugging information
##### getCode
```php
public function getCode()
```
##### getFile
```php
public function getFile(): string
```
###### Returns
`string`
##### getLine
```php
public function getLine(): int
```
###### Returns
`int`
##### getMessage
```php
public function getMessage(): string
```
###### Returns
`string`
##### getPrevious
```php
public function getPrevious(): ?Throwable
```
###### Returns
`Throwable` | `null`
##### getTrace
```php
public function getTrace(): array
```
###### Returns
`array`
##### getTraceAsString
```php
public function getTraceAsString(): string
```
###### Returns
`string`
##### kind
```php
public function kind(): OpenFGA\Exceptions\ClientError|OpenFGA\Exceptions\AuthenticationError|OpenFGA\Exceptions\ConfigurationError|OpenFGA\Exceptions\NetworkError|OpenFGA\Exceptions\SerializationError
```
Get the specific error category for this exception. Returns the error classification that indicates the general category of the problem (authentication, configuration, network, etc.), allowing for categorized error handling and reporting. This categorization helps applications implement appropriate retry logic, user messaging, and error recovery strategies based on the type of failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L40)
###### Returns
[`ClientError`](https://github.com/evansims/openfga-php/blob/main/ClientError.md) | [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/AuthenticationError.md) | [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/ConfigurationError.md) | [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/NetworkError.md) | [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/SerializationError.md) — The error category enum indicating the type of failure
##### previous
```php
public function previous(): ?Throwable
```
Get the previous exception that caused this one. Provides access to the exception chain for cases where this exception was triggered by another underlying exception. This maintains the full context of error propagation and is essential for root cause analysis when exceptions are wrapped or transformed during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L48)
###### Returns
`Throwable` | `null` — The previous exception in the chain, or null if this is the root exception
##### request
```php
public function request(): ?Psr\Http\Message\RequestInterface
```
Get the HTTP request associated with this exception. Returns the PSR-7 HTTP request that was being processed when this exception occurred. This is particularly useful for debugging API call failures, allowing developers to inspect the request URL, headers, body, and method that led to the error condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L56)
###### Returns
`Psr\Http\Message\RequestInterface` | `null` — The PSR-7 HTTP request that triggered the exception, or null if not applicable
##### response
```php
public function response(): ?Psr\Http\Message\ResponseInterface
```
Get the HTTP response associated with this exception. Returns the PSR-7 HTTP response that was received when this exception occurred, providing access to status codes, headers, and response body for debugging. This is especially valuable for understanding API-level failures and can contain detailed error messages from the OpenFGA service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Exceptions/ExceptionTrait.php#L64)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null` — The PSR-7 HTTP response received from the API, or null if no response was received
<!-- End of evansims/openfga-php/docs/API/Exceptions/SerializationException.md -->
<!-- Source: evansims/openfga-php/docs/API/Integration/README.md -->
## Integration
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Integration
Framework integration helpers and service providers.
**Total Components:** 1
### Classes
| Name | Description |
|------|-------------|
| [`ServiceProvider`](https://github.com/evansims/openfga-php/blob/main/./ServiceProvider.md) | Service provider for automatic dependency injection container registration. This class enables au... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Integration/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Integration/ServiceProvider.md -->
### ServiceProvider
Service provider for automatic dependency injection container registration. This class enables automatic registration of OpenFGA services in frameworks that support the tbachert/spi service provider interface pattern.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`register()`](#register)
</details>
#### Namespace
`OpenFGA\Integration`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Integration/ServiceProvider.php)
#### Methods
##### register
```php
public function register(object $container): void
```
Register OpenFGA services with the dependency injection container. This method registers the core OpenFGA interfaces with their default implementations, enabling automatic dependency resolution in SPI-compatible frameworks. Note: This service provider registers basic implementations that work without configuration. For production use, you should override these registrations with properly configured instances. Services registered: - TelemetryInterface: null telemetry provider (can be overridden) - TransformerInterface: DSL to model transformation - SchemaValidatorInterface: JSON schema validation for models Services NOT registered (require configuration): - ClientInterface: Requires URL and authentication configuration - RequestManagerInterface: Requires URL and retry configuration
[View source](https://github.com/evansims/openfga-php/blob/main/src/Integration/ServiceProvider.php#L46)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ---------------------------------- |
| `$container` | `object` | The dependency injection container |
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Integration/ServiceProvider.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Assertions.md -->
### Assertions
Collection implementation for OpenFGA assertion models.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Assertions.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/AssertionsInterface.md)
#### Related Classes
- [AssertionsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/AssertionsInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Assertions.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/AssertionsInterface.md -->
### AssertionsInterface
Collection interface for OpenFGA assertion models. This interface defines a collection that holds assertion objects used for testing authorization model correctness. Assertions represent expected authorization outcomes for specific tuple configurations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/AssertionsInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Assertions](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Assertions.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/AssertionsInterface.php#L31)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/AssertionsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/AuthorizationModels.md -->
### AuthorizationModels
Collection implementation for OpenFGA authorization model objects. This class provides a concrete implementation for managing collections of authorization model objects. Authorization models define the relationship structure, permissions, and conditions within an OpenFGA store, serving as the schema for authorization decisions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/AuthorizationModels.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`AuthorizationModelsInterface`](https://github.com/evansims/openfga-php/blob/main/AuthorizationModelsInterface.md)
#### Related Classes
- [AuthorizationModelsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/AuthorizationModelsInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/AuthorizationModels.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/AuthorizationModelsInterface.md -->
### AuthorizationModelsInterface
Collection interface for OpenFGA authorization model objects. This interface defines a collection that holds authorization model objects, which define the relationship structure and permissions within an OpenFGA store. Each model contains type definitions, relations, and optionally conditions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/AuthorizationModelsInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [AuthorizationModels](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/AuthorizationModels.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/AuthorizationModelsInterface.php#L31)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/AuthorizationModelsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/BatchCheckItems.md -->
### BatchCheckItems
Collection of batch check items for batch authorization requests. This collection maintains a list of BatchCheckItem objects, each representing a single authorization check to be performed as part of a batch request.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/BatchCheckItems.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/BatchCheckItemsInterface.md)
#### Related Classes
- [BatchCheckItemsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/BatchCheckItemsInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/BatchCheckItems.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/BatchCheckItemsInterface.md -->
### BatchCheckItemsInterface
Collection of batch check items for batch authorization requests. This collection maintains a list of BatchCheckItem objects, each representing a single authorization check to be performed as part of a batch request.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/BatchCheckItemsInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [BatchCheckItems](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/BatchCheckItems.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<int|string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L177)
###### Returns
`array<int` | `string, mixed>`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/BatchCheckItemsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Computeds.md -->
### Computeds
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Computeds.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`ComputedsInterface`](https://github.com/evansims/openfga-php/blob/main/ComputedsInterface.md)
#### Related Classes
- [ComputedsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/ComputedsInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Computeds.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/ComputedsInterface.md -->
### ComputedsInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/ComputedsInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Computeds](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Computeds.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<int, array{userset: string}>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/ComputedsInterface.php#L18)
###### Returns
`array<`int`, `array{userset: string}`>`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/ComputedsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/ConditionParameters.md -->
### ConditionParameters
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/ConditionParameters.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`ConditionParametersInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionParametersInterface.md)
#### Related Classes
- [ConditionParametersInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/ConditionParametersInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/ConditionParameters.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/ConditionParametersInterface.md -->
### ConditionParametersInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/ConditionParametersInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [ConditionParameters](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/ConditionParameters.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/ConditionParametersInterface.php#L18)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/ConditionParametersInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Conditions.md -->
### Conditions
Collection implementation for OpenFGA condition objects. This class provides a concrete implementation for managing collections of condition objects that enable context-aware authorization decisions in OpenFGA authorization models. Conditions allow for dynamic access control based on runtime attributes and environmental factors. Each condition in the collection defines an expression, parameters, and metadata that determine how authorization decisions should be evaluated when specific contextual criteria are met.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Conditions.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionsInterface.md)
#### Related Classes
- [ConditionsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/ConditionsInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Conditions.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/ConditionsInterface.md -->
### ConditionsInterface
Collection interface for OpenFGA condition objects. This interface defines a collection that holds condition objects used in authorization models to implement context-aware authorization decisions. Conditions allow for dynamic authorization based on attributes and runtime context, enabling sophisticated access control patterns. Each condition includes an expression, parameters, and optional metadata that define how the condition should be evaluated during authorization checks.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/ConditionsInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Conditions](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Conditions.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/ConditionsInterface.php#L30)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/ConditionsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/IndexedCollectionInterface.md -->
### IndexedCollectionInterface
Represents a type-safe collection indexed by integers, similar to a JSON array. This interface provides a type-safe, feature-rich collection implementation for OpenFGA model objects that maintains array-like semantics while offering additional functionality for filtering, transformation, and validation. IndexedCollections are used throughout the OpenFGA SDK to manage: - Lists of relationship tuples - Collections of type definitions in authorization models - Arrays of conditions and parameters - Sets of user objects and userset operations - Sequences of authorization model versions The collection provides both familiar array-style access (through ArrayAccess) and enhanced functional programming methods (filter, map, reduce) that make working with authorization data more expressive and safer. All items in the collection are validated to ensure they implement the expected ModelInterface. Collections support both mutable operations (like `add()` and `clear()`) for incremental building and immutable operations (like `withItems()` and `filter()`) for functional programming patterns, providing flexibility while maintaining data integrity in authorization contexts where consistency is critical.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php)
#### Implements
- `ArrayAccess`
- `Countable`
- `Iterator`
- `JsonSerializable`
- `Traversable`
#### Related Classes
- [IndexedCollection](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/IndexedCollection.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<int|string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L177)
###### Returns
`array<int` | `string, mixed>`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/IndexedCollectionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/KeyedCollectionInterface.md -->
### KeyedCollectionInterface
Represents a collection that is indexed by a string, like a JSON object.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`count()`](#count)
- [`current()`](#current)
- [`get()`](#get)
- [`has()`](#has)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`rewind()`](#rewind)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php)
#### Implements
- `ArrayAccess`
- `Countable`
- `Iterator`
- `JsonSerializable`
- `Traversable`
#### Related Classes
- [KeyedCollection](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/KeyedCollection.md) (implementation)
#### Methods
##### add
```php
public function add(string $key, T $item): static
```
Add an item to the collection with the specified key. This method associates an item with a string key, allowing for named access to collection elements similar to an associative array.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L52)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ----------------------------------------- |
| `$key` | `string` | The string key to associate with the item |
| `$item` | `T` | The item to add to the collection |
###### Returns
`static`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L58)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L67)
###### Returns
`T`
##### get
```php
public function get(string $key): T|null
```
Get an item by its string key. This method retrieves the item associated with the specified key. Returns null if no item is found with the given key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L78)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------- |
| `$key` | `string` | The key of the item to retrieve |
###### Returns
`T` | `null` — The item associated with the key, or null if not found
##### has
```php
public function has(string $key): bool
```
Check if a key exists in the collection. This method determines whether the collection contains an item associated with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------ |
| `$key` | `string` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L99)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L105)
###### Returns
`array<`string`, `mixed`>`
##### key
```php
public function key(): string
```
Get the current iterator key. This method returns the current string key in the collection iteration. For keyed collections, this is always a string identifier.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L118)
###### Returns
`string` — The current iterator key
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L127)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ------------------------------ |
| `$offset` | `mixed` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
Get an item by its offset key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L149)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L158)
###### Parameters
| Name | Type | Description |
| --------- | ---------------------- | ----------- |
| `$offset` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L164)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L173)
###### Returns
`void`
##### toArray
```php
public function toArray(): array<string, T>
```
Convert the collection to a standard PHP associative array. This method creates a native PHP associative array containing all items in the collection, preserving their string keys and values.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L183)
###### Returns
`array<`string`, `T`>` — An associative array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L194)
###### Returns
`bool` — True if the current position is valid, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Collections/KeyedCollectionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Nodes.md -->
### Nodes
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Nodes.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`NodesInterface`](https://github.com/evansims/openfga-php/blob/main/NodesInterface.md)
#### Related Classes
- [NodesInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/NodesInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Nodes.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/NodesInterface.md -->
### NodesInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/NodesInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Nodes](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Nodes.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/NodesInterface.php#L25)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/NodesInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/README.md -->
## Collections
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Models > Collections
Type-safe collections for managing groups of domain objects.
**Total Components:** 42
### Interfaces
| Name | Description |
|------|-------------|
| [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/./AssertionsInterface.md) | Collection interface for OpenFGA assertion models. This interface defines a collection that holds... |
| [`AuthorizationModelsInterface`](https://github.com/evansims/openfga-php/blob/main/./AuthorizationModelsInterface.md) | Collection interface for OpenFGA authorization model objects. This interface defines a collection... |
| [`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckItemsInterface.md) | Collection of batch check items for batch authorization requests. This collection maintains a lis... |
| [`ComputedsInterface`](https://github.com/evansims/openfga-php/blob/main/./ComputedsInterface.md) | |
| [`ConditionParametersInterface`](https://github.com/evansims/openfga-php/blob/main/./ConditionParametersInterface.md) | |
| [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/./ConditionsInterface.md) | Collection interface for OpenFGA condition objects. This interface defines a collection that hold... |
| [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/./IndexedCollectionInterface.md) | Represents a type-safe collection indexed by integers, similar to a JSON array. This interface pr... |
| [`KeyedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/./KeyedCollectionInterface.md) | Represents a collection that is indexed by a string, like a JSON object. |
| [`NodesInterface`](https://github.com/evansims/openfga-php/blob/main/./NodesInterface.md) | |
| [`RelationMetadataCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/./RelationMetadataCollectionInterface.md) | Collection interface for OpenFGA relation metadata objects. This interface defines a keyed collec... |
| [`RelationReferencesInterface`](https://github.com/evansims/openfga-php/blob/main/./RelationReferencesInterface.md) | |
| [`StoresInterface`](https://github.com/evansims/openfga-php/blob/main/./StoresInterface.md) | Collection interface for OpenFGA store objects. This interface defines a collection that holds st... |
| [`TupleChangesInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleChangesInterface.md) | |
| [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleKeysInterface.md) | A collection of relationship tuple keys. This interface represents a type-safe collection of tupl... |
| [`TuplesInterface`](https://github.com/evansims/openfga-php/blob/main/./TuplesInterface.md) | Collection interface for OpenFGA tuple objects. This interface defines a collection that holds tu... |
| [`TypeDefinitionRelationsInterface`](https://github.com/evansims/openfga-php/blob/main/./TypeDefinitionRelationsInterface.md) | |
| [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/./TypeDefinitionsInterface.md) | Collection interface for OpenFGA type definition objects. This interface defines a collection tha... |
| [`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/./UserTypeFiltersInterface.md) | |
| [`UsersInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersInterface.md) | Represents a collection of users in authorization contexts. This collection manages users who hav... |
| [`UsersListInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersListInterface.md) | |
| [`UsersetUnionInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersetUnionInterface.md) | Represents a specialized collection for userset union operations. This collection is specifically... |
| [`UsersetsInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersetsInterface.md) | Represents a collection of usersets used in authorization model operations. This collection manag... |
### Classes
| Name | Description |
|------|-------------|
| [`Assertions`](https://github.com/evansims/openfga-php/blob/main/./Assertions.md) | Collection implementation for OpenFGA assertion models. |
| [`AuthorizationModels`](https://github.com/evansims/openfga-php/blob/main/./AuthorizationModels.md) | Collection implementation for OpenFGA authorization model objects. This class provides a concrete... |
| [`BatchCheckItems`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckItems.md) | Collection of batch check items for batch authorization requests. This collection maintains a lis... |
| [`Computeds`](https://github.com/evansims/openfga-php/blob/main/./Computeds.md) | |
| [`ConditionParameters`](https://github.com/evansims/openfga-php/blob/main/./ConditionParameters.md) | |
| [`Conditions`](https://github.com/evansims/openfga-php/blob/main/./Conditions.md) | Collection implementation for OpenFGA condition objects. This class provides a concrete implement... |
| [`Nodes`](https://github.com/evansims/openfga-php/blob/main/./Nodes.md) | |
| [`RelationMetadataCollection`](https://github.com/evansims/openfga-php/blob/main/./RelationMetadataCollection.md) | Collection implementation for OpenFGA relation metadata objects. This class provides a concrete i... |
| [`RelationReferences`](https://github.com/evansims/openfga-php/blob/main/./RelationReferences.md) | |
| [`Stores`](https://github.com/evansims/openfga-php/blob/main/./Stores.md) | Collection implementation for OpenFGA store objects. This class provides a concrete implementatio... |
| [`TupleChanges`](https://github.com/evansims/openfga-php/blob/main/./TupleChanges.md) | |
| [`TupleKeys`](https://github.com/evansims/openfga-php/blob/main/./TupleKeys.md) | Collection implementation for OpenFGA tuple key objects. This class provides a concrete implement... |
| [`Tuples`](https://github.com/evansims/openfga-php/blob/main/./Tuples.md) | Collection implementation for OpenFGA tuple objects. This class provides a concrete implementatio... |
| [`TypeDefinitionRelations`](https://github.com/evansims/openfga-php/blob/main/./TypeDefinitionRelations.md) | |
| [`TypeDefinitions`](https://github.com/evansims/openfga-php/blob/main/./TypeDefinitions.md) | Collection implementation for OpenFGA type definition objects. This class provides a concrete imp... |
| [`UserTypeFilters`](https://github.com/evansims/openfga-php/blob/main/./UserTypeFilters.md) | |
| [`Users`](https://github.com/evansims/openfga-php/blob/main/./Users.md) | |
| [`UsersList`](https://github.com/evansims/openfga-php/blob/main/./UsersList.md) | |
| [`UsersetUnion`](https://github.com/evansims/openfga-php/blob/main/./UsersetUnion.md) | |
| [`Usersets`](https://github.com/evansims/openfga-php/blob/main/./Usersets.md) | |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Models/Collections/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/RelationMetadataCollection.md -->
### RelationMetadataCollection
Collection implementation for OpenFGA relation metadata objects. This class provides a concrete implementation for managing keyed collections of relation metadata objects. Relation metadata provides additional context about relations defined in authorization model type definitions, including module information and source file details. The collection uses relation names as keys, enabling efficient retrieval of metadata for specific relations within a type definition.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`count()`](#count)
- [`current()`](#current)
- [`get()`](#get)
- [`has()`](#has)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/RelationMetadataCollection.php)
#### Implements
- [`KeyedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/KeyedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`RelationMetadataCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/RelationMetadataCollectionInterface.md)
#### Related Classes
- [RelationMetadata](https://github.com/evansims/openfga-php/blob/main/../Models/RelationMetadata.md) (item)
- [RelationMetadataCollectionInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/RelationMetadataCollectionInterface.md) (interface)
#### Methods
##### add
```php
public function add(string $key, OpenFGA\Models\ModelInterface $item): static
```
Add an item to the collection with the specified key. This method associates an item with a string key, allowing for named access to collection elements similar to an associative array.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L137)
###### Parameters
| Name | Type | Description |
| ------- | ----------------------------------------------- | ----------------------------------------- |
| `$key` | `string` | The string key to associate with the item |
| `$item` | [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | The item to add to the collection |
###### Returns
`static`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L154)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L168)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### get
```php
public function get(string $key)
```
Get an item by its string key. This method retrieves the item associated with the specified key. Returns null if no item is found with the given key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L179)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------- |
| `$key` | `string` | The key of the item to retrieve |
##### has
```php
public function has(string $key): bool
```
Check if a key exists in the collection. This method determines whether the collection contains an item associated with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L188)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------ |
| `$key` | `string` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L197)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L208)
###### Returns
`array<`string`, `mixed`>`
##### key
```php
public function key(): string
```
Get the current iterator key. This method returns the current string key in the collection iteration. For keyed collections, this is always a string identifier.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L232)
###### Returns
`string` — The current iterator key
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L247)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L256)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ------------------------------ |
| `$offset` | `mixed` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
Get an item by its offset key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L269)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L286)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L303)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L314)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\KeyedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure and validation rules for this collection, including the expected item type and constraints.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L37)
###### Returns
`CollectionSchemaInterface` — The collection schema
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP associative array. This method creates a native PHP associative array containing all items in the collection, preserving their string keys and values.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L323)
###### Returns
`array` — An associative array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L342)
###### Returns
`bool` — True if the current position is valid, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Collections/RelationMetadataCollection.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/RelationMetadataCollectionInterface.md -->
### RelationMetadataCollectionInterface
Collection interface for OpenFGA relation metadata objects. This interface defines a keyed collection that holds relation metadata objects, which provide additional information about the relations defined in authorization model type definitions. Relation metadata includes details such as the module name and source file information for authorization models. The collection is keyed by relation names, allowing efficient access to metadata for specific relations within a type definition.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`count()`](#count)
- [`current()`](#current)
- [`get()`](#get)
- [`has()`](#has)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`rewind()`](#rewind)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/RelationMetadataCollectionInterface.php)
#### Implements
- [`KeyedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/KeyedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [RelationMetadataCollection](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/RelationMetadataCollection.md) (implementation)
- [RelationMetadataInterface](https://github.com/evansims/openfga-php/blob/main/../Models/RelationMetadataInterface.md) (item)
#### Methods
##### add
```php
public function add(string $key, T $item): static
```
Add an item to the collection with the specified key. This method associates an item with a string key, allowing for named access to collection elements similar to an associative array.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L52)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ----------------------------------------- |
| `$key` | `string` | The string key to associate with the item |
| `$item` | `T` | The item to add to the collection |
###### Returns
`static`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L58)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L67)
###### Returns
`T`
##### get
```php
public function get(string $key): T|null
```
Get an item by its string key. This method retrieves the item associated with the specified key. Returns null if no item is found with the given key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L78)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------- |
| `$key` | `string` | The key of the item to retrieve |
###### Returns
`T` | `null` — The item associated with the key, or null if not found
##### has
```php
public function has(string $key): bool
```
Check if a key exists in the collection. This method determines whether the collection contains an item associated with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------ |
| `$key` | `string` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L99)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L105)
###### Returns
`array<`string`, `mixed`>`
##### key
```php
public function key(): string
```
Get the current iterator key. This method returns the current string key in the collection iteration. For keyed collections, this is always a string identifier.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L118)
###### Returns
`string` — The current iterator key
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L127)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ------------------------------ |
| `$offset` | `mixed` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
Get an item by its offset key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L149)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L158)
###### Parameters
| Name | Type | Description |
| --------- | ---------------------- | ----------- |
| `$offset` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L164)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L173)
###### Returns
`void`
##### toArray
```php
public function toArray(): array<string, T>
```
Convert the collection to a standard PHP associative array. This method creates a native PHP associative array containing all items in the collection, preserving their string keys and values.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L183)
###### Returns
`array<`string`, `T`>` — An associative array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L194)
###### Returns
`bool` — True if the current position is valid, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Collections/RelationMetadataCollectionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/RelationReferences.md -->
### RelationReferences
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/RelationReferences.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`RelationReferencesInterface`](https://github.com/evansims/openfga-php/blob/main/RelationReferencesInterface.md)
#### Related Classes
- [RelationReferencesInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/RelationReferencesInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/RelationReferences.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/RelationReferencesInterface.md -->
### RelationReferencesInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/RelationReferencesInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [RelationReferences](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/RelationReferences.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<string, array{type: string, relation?: string, wildcard?: object, condition?: string}>
```
Serialize the collection to an array.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/RelationReferencesInterface.php#L20)
###### Returns
`array<`string`, `array{type: string`, `relation?: string`, `wildcard?: object`, `condition?: string}`>`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/RelationReferencesInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Stores.md -->
### Stores
Collection implementation for OpenFGA store objects. This class provides a concrete implementation for managing collections of store objects that represent individual OpenFGA authorization stores. Each store provides an isolated authorization domain with its own models, tuples, and configuration for multi-tenant authorization systems.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Stores.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`StoresInterface`](https://github.com/evansims/openfga-php/blob/main/StoresInterface.md)
#### Related Classes
- [StoresInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/StoresInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Stores.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/StoresInterface.md -->
### StoresInterface
Collection interface for OpenFGA store objects. This interface defines a collection that holds store objects representing individual OpenFGA authorization stores. Each store is an isolated authorization domain with its own models, tuples, and configuration, providing multi-tenancy within the OpenFGA system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/StoresInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Stores](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Stores.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/StoresInterface.php#L33)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/StoresInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TupleChanges.md -->
### TupleChanges
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TupleChanges.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`TupleChangesInterface`](https://github.com/evansims/openfga-php/blob/main/TupleChangesInterface.md)
#### Related Classes
- [TupleChangesInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TupleChangesInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TupleChanges.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TupleChangesInterface.md -->
### TupleChangesInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TupleChangesInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [TupleChanges](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TupleChanges.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TupleChangesInterface.php#L27)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TupleChangesInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TupleKeys.md -->
### TupleKeys
Collection implementation for OpenFGA tuple key objects. This class provides a concrete implementation for managing collections of tuple key objects that define relationships between users, objects, and relations in the OpenFGA authorization system. Tuple keys are the essential components used to express authorization relationships and permissions. This collection is commonly used in write operations to specify which relationships should be created or deleted in the authorization store.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TupleKeys.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeysInterface.md)
#### Related Classes
- [TupleKeysInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TupleKeysInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TupleKeys.php#L40)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TupleKeys.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TupleKeysInterface.md -->
### TupleKeysInterface
A collection of relationship tuple keys. This interface represents a type-safe collection of tuple keys that define relationships between users, objects, and relations in the authorization model. Tuple keys are the fundamental building blocks for expressing permissions and relationships.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TupleKeysInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [TupleKeys](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TupleKeys.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<int|string, mixed>
```
Serialize the tuple keys collection for JSON encoding. This method prepares the collection of tuple keys for JSON serialization, ensuring that each tuple key is properly formatted for API requests or storage.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TupleKeysInterface.php#L31)
###### Returns
`array<int` | `string, mixed>` — The serialized collection ready for JSON encoding
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TupleKeysInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Tuples.md -->
### Tuples
Collection implementation for OpenFGA tuple objects. This class provides a concrete implementation for managing collections of tuple objects that represent relationship facts in the OpenFGA authorization system. Tuples define the actual relationships between users, objects, and relations that drive authorization decisions. Each tuple includes both the relationship key and a timestamp, making this collection useful for both current state queries and historical analysis.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Tuples.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`TuplesInterface`](https://github.com/evansims/openfga-php/blob/main/TuplesInterface.md)
#### Related Classes
- [TuplesInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TuplesInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Tuples.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TuplesInterface.md -->
### TuplesInterface
Collection interface for OpenFGA tuple objects. This interface defines a collection that holds tuple objects representing relationship facts in the OpenFGA authorization system. Tuples define the actual relationships between users, objects, and relations that are used for authorization decisions. Each tuple contains a key (defining the relationship) and a timestamp (recording when the relationship was established), making them essential for both authorization checks and audit trails.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TuplesInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Tuples](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Tuples.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TuplesInterface.php#L31)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TuplesInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TypeDefinitionRelations.md -->
### TypeDefinitionRelations
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`count()`](#count)
- [`current()`](#current)
- [`get()`](#get)
- [`has()`](#has)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TypeDefinitionRelations.php)
#### Implements
- [`KeyedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/KeyedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`TypeDefinitionRelationsInterface`](https://github.com/evansims/openfga-php/blob/main/TypeDefinitionRelationsInterface.md)
#### Related Classes
- [TypeDefinitionRelationsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TypeDefinitionRelationsInterface.md) (interface)
#### Methods
##### add
```php
public function add(string $key, OpenFGA\Models\ModelInterface $item): static
```
Add an item to the collection with the specified key. This method associates an item with a string key, allowing for named access to collection elements similar to an associative array.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L137)
###### Parameters
| Name | Type | Description |
| ------- | ----------------------------------------------- | ----------------------------------------- |
| `$key` | `string` | The string key to associate with the item |
| `$item` | [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | The item to add to the collection |
###### Returns
`static`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L154)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L168)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### get
```php
public function get(string $key)
```
Get an item by its string key. This method retrieves the item associated with the specified key. Returns null if no item is found with the given key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L179)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------- |
| `$key` | `string` | The key of the item to retrieve |
##### has
```php
public function has(string $key): bool
```
Check if a key exists in the collection. This method determines whether the collection contains an item associated with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L188)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------ |
| `$key` | `string` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L197)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L208)
###### Returns
`array<`string`, `mixed`>`
##### key
```php
public function key(): string
```
Get the current iterator key. This method returns the current string key in the collection iteration. For keyed collections, this is always a string identifier.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L232)
###### Returns
`string` — The current iterator key
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L247)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L256)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ------------------------------ |
| `$offset` | `mixed` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
Get an item by its offset key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L269)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L286)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L303)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L314)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\KeyedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure and validation rules for this collection, including the expected item type and constraints.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L37)
###### Returns
`CollectionSchemaInterface` — The collection schema
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP associative array. This method creates a native PHP associative array containing all items in the collection, preserving their string keys and values.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L323)
###### Returns
`array` — An associative array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollection.php#L342)
###### Returns
`bool` — True if the current position is valid, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TypeDefinitionRelations.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TypeDefinitionRelationsInterface.md -->
### TypeDefinitionRelationsInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`count()`](#count)
- [`current()`](#current)
- [`get()`](#get)
- [`has()`](#has)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`rewind()`](#rewind)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TypeDefinitionRelationsInterface.php)
#### Implements
- [`KeyedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/KeyedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [TypeDefinitionRelations](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TypeDefinitionRelations.md) (implementation)
#### Methods
##### add
```php
public function add(string $key, T $item): static
```
Add an item to the collection with the specified key. This method associates an item with a string key, allowing for named access to collection elements similar to an associative array.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L52)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ----------------------------------------- |
| `$key` | `string` | The string key to associate with the item |
| `$item` | `T` | The item to add to the collection |
###### Returns
`static`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L58)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L67)
###### Returns
`T`
##### get
```php
public function get(string $key): T|null
```
Get an item by its string key. This method retrieves the item associated with the specified key. Returns null if no item is found with the given key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L78)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------- |
| `$key` | `string` | The key of the item to retrieve |
###### Returns
`T` | `null` — The item associated with the key, or null if not found
##### has
```php
public function has(string $key): bool
```
Check if a key exists in the collection. This method determines whether the collection contains an item associated with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ------------------------------ |
| `$key` | `string` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L99)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the collection to an array.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TypeDefinitionRelationsInterface.php#L20)
###### Returns
`array<`string`, `mixed`>`
##### key
```php
public function key(): string
```
Get the current iterator key. This method returns the current string key in the collection iteration. For keyed collections, this is always a string identifier.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L118)
###### Returns
`string` — The current iterator key
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L127)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item with the specified key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ------------------------------ |
| `$offset` | `mixed` | The key to check for existence |
###### Returns
`bool` — True if the key exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
Get an item by its offset key.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L149)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L158)
###### Parameters
| Name | Type | Description |
| --------- | ---------------------- | ----------- |
| `$offset` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L164)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L173)
###### Returns
`void`
##### toArray
```php
public function toArray(): array<string, T>
```
Convert the collection to a standard PHP associative array. This method creates a native PHP associative array containing all items in the collection, preserving their string keys and values.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L183)
###### Returns
`array<`string`, `T`>` — An associative array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid key-value pair in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/KeyedCollectionInterface.php#L194)
###### Returns
`bool` — True if the current position is valid, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TypeDefinitionRelationsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TypeDefinitions.md -->
### TypeDefinitions
Collection implementation for OpenFGA type definition objects. This class provides a concrete implementation for managing collections of type definition objects that specify object types, relations, and metadata within an authorization model. Type definitions are fundamental building blocks that define the schema for authorization relationships.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TypeDefinitions.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/TypeDefinitionsInterface.md)
#### Related Classes
- [TypeDefinitionsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TypeDefinitionsInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TypeDefinitions.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/TypeDefinitionsInterface.md -->
### TypeDefinitionsInterface
Collection interface for OpenFGA type definition objects. This interface defines a collection that holds type definition objects which specify the object types, their relations, and metadata within an authorization model. Type definitions form the core schema that defines how different object types relate to each other in the system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TypeDefinitionsInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [TypeDefinitions](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/TypeDefinitions.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/TypeDefinitionsInterface.php#L31)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/TypeDefinitionsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UserTypeFilters.md -->
### UserTypeFilters
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UserTypeFilters.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/UserTypeFiltersInterface.md)
#### Related Classes
- [UserTypeFiltersInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UserTypeFiltersInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UserTypeFilters.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UserTypeFiltersInterface.md -->
### UserTypeFiltersInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UserTypeFiltersInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [UserTypeFilters](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UserTypeFilters.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<int, array{type: string, relation?: string}>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UserTypeFiltersInterface.php#L18)
###### Returns
`array<`int`, `array{type: string`, `relation?: string}`>`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UserTypeFiltersInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Users.md -->
### Users
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Users.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`UsersInterface`](https://github.com/evansims/openfga-php/blob/main/UsersInterface.md)
#### Related Classes
- [UsersInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UsersInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Users.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UsersInterface.md -->
### UsersInterface
Represents a collection of users in authorization contexts. This collection manages users who have been granted access through various authorization mechanisms. Users can be individual identities, usersets, or wildcard patterns depending on the authorization model configuration.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Users](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Users.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<int, array{object?: mixed, userset?: array{type: string, id: string, relation: string}, wildcard?: array{type: string}}>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersInterface.php#L24)
###### Returns
`array<`int`, `array{object?: mixed`, `userset?: array{type: string`, `id: string`, `relation: string}`, `wildcard?: array{type: string}}`>`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UsersInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UsersList.md -->
### UsersList
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersList.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`UsersListInterface`](https://github.com/evansims/openfga-php/blob/main/UsersListInterface.md)
#### Related Classes
- [UsersListInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UsersListInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L269)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UsersList.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UsersListInterface.md -->
### UsersListInterface
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersListInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [UsersList](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UsersList.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array<int, string>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersListInterface.php#L18)
###### Returns
`array<`int`, `string`>`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UsersListInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UsersetUnion.md -->
### UsersetUnion
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersetUnion.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`UsersetUnionInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetUnionInterface.md)
#### Related Classes
- [UsersetUnionInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UsersetUnionInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersetUnion.php#L30)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UsersetUnion.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UsersetUnionInterface.md -->
### UsersetUnionInterface
Represents a specialized collection for userset union operations. This collection is specifically designed for managing usersets in union operations, where users are granted access if they satisfy ANY of the contained usersets. The collection provides optimized serialization for union-specific data structures.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersetUnionInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [UsersetUnion](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UsersetUnion.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersetUnionInterface.php#L26)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UsersetUnionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/Usersets.md -->
### Usersets
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`schema()`](#schema)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Usersets.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
- [`UsersetsInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetsInterface.md)
#### Related Classes
- [UsersetsInterface](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/UsersetsInterface.md) (interface)
#### Methods
##### add
```php
public function add(mixed $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L142)
###### Parameters
| Name | Type | Description |
| ------- | ----- | ------------------------------------------------- |
| `$item` | mixed | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L157)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L169)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L182)
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md)
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L193)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L214)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL)
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L232)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
##### get
```php
public function get(int $offset)
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L251)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L260)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/Usersets.php#L45)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L285)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L300)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L309)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): ?OpenFGA\Models\ModelInterface
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L322)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
[`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/../Models/ModelInterface.md) | `null`
##### offsetSet
```php
public function offsetSet(mixed $offset, mixed $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L339)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
| `$value` | `mixed` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L356)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(mixed $initial, callable $callback): mixed
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L373)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `mixed` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`mixed` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L388)
###### Returns
`void`
##### schema
*<small>Implements Models\Collections\IndexedCollectionInterface</small>*
```php
public function schema(): CollectionSchemaInterface
```
Get the schema definition for this collection type. Returns the schema that defines the structure, validation rules, and serialization behavior for this collection type. The schema specifies the expected item type, validation constraints, and transformation rules that ensure all items in the collection conform to OpenFGA data requirements. Collection schemas enable: - Type validation for all added items - Consistent serialization across different contexts - API compatibility verification - Runtime type checking and error reporting The schema system ensures that authorization data maintains integrity throughout processing, preventing type mismatches that could lead to authorization failures or security vulnerabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L74)
###### Returns
`CollectionSchemaInterface` — The schema definition containing validation rules and type constraints for this collection
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L397)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L412)
###### Returns
`array` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L421)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollection.php#L436)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/Usersets.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Collections/UsersetsInterface.md -->
### UsersetsInterface
Represents a collection of usersets used in authorization model operations. This collection manages multiple userset definitions that are used in complex authorization operations like unions, intersections, and differences. Each userset in the collection can define different ways to compute authorized users.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`add()`](#add)
- [`clear()`](#clear)
- [`count()`](#count)
- [`current()`](#current)
- [`every()`](#every)
- [`filter()`](#filter)
- [`first()`](#first)
- [`get()`](#get)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`key()`](#key)
- [`next()`](#next)
- [`offsetExists()`](#offsetexists)
- [`offsetGet()`](#offsetget)
- [`offsetSet()`](#offsetset)
- [`offsetUnset()`](#offsetunset)
- [`reduce()`](#reduce)
- [`rewind()`](#rewind)
- [`some()`](#some)
- [`toArray()`](#toarray)
- [`valid()`](#valid)
- [`withItems()`](#withitems)
</details>
#### Namespace
`OpenFGA\Models\Collections`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersetsInterface.php)
#### Implements
- [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/IndexedCollectionInterface.md)
- `Traversable`
- `JsonSerializable`
- `Iterator`
- `Countable`
- `ArrayAccess`
#### Related Classes
- [Usersets](https://github.com/evansims/openfga-php/blob/main/../Models/Collections/Usersets.md) (implementation)
#### Methods
##### add
```php
public function add(T $item): static
```
Add an item to the end of the collection. This method appends a new model object to the collection, automatically assigning it the next available integer index. The item is validated to ensure it matches the expected type for this collection, maintaining type safety throughout the authorization data processing pipeline. This operation modifies the current collection instance directly, making it suitable for building collections incrementally. For immutable operations, use the `withItems()` method instead, which creates new collection instances without modifying the original.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L95)
###### Parameters
| Name | Type | Description |
| ------- | ---- | ------------------------------------------------- |
| `$item` | `T` | The OpenFGA model object to add to the collection |
###### Returns
`static`
##### clear
```php
public function clear(): void
```
Remove all items from the collection. This method empties the collection, resetting it to its initial state with no items and a count of zero.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L103)
###### Returns
`void`
##### count
```php
public function count(): int<0, max>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L109)
###### Returns
`int<`0`, `max`>`
##### current
```php
public function current(): T
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L116)
###### Returns
`T`
##### every
```php
public function every(callable $callback): bool
```
Check if all items in the collection match the given condition. This method tests whether all items in the collection satisfy the provided callback function. Returns true if all items pass the test, false if any item fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if all items match the condition, false otherwise
##### filter
```php
public function filter(callable $callback): static
```
Create a new collection containing only items that match the condition. This method creates a new collection containing only the items from the current collection that satisfy the provided callback function.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L139)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`static` — A new collection containing only the matching items
##### first
```php
public function first(?callable $callback = NULL): T|null
```
Get the first item in the collection, optionally matching a condition. When called without a callback, returns the first item in the collection. When called with a callback, returns the first item that satisfies the condition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L150)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------ | ----------- |
| `$callback` | `callable` | `null` | |
###### Returns
`T` | `null` — The first matching item, or null if none found
##### get
```php
public function get(int $offset): T|null
```
Get an item by its position in the collection. This method retrieves the item at the specified index position. Returns null if the index is out of bounds.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L161)
###### Parameters
| Name | Type | Description |
| --------- | ----- | ------------------------------------------ |
| `$offset` | `int` | The index position of the item to retrieve |
###### Returns
`T` | `null` — The item at the specified position, or null if not found
##### isEmpty
```php
public function isEmpty(): bool
```
Check if the collection contains no items. This method provides a convenient way to test whether the collection is empty without needing to check the count.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L171)
###### Returns
`bool` — True if the collection is empty, false otherwise
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/UsersetsInterface.php#L24)
###### Returns
`array`
##### key
```php
public function key(): int
```
Get the current iterator key. This method returns the current position in the collection iteration, which is always an integer for indexed collections.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L188)
###### Returns
`int` — The current iterator position
##### next
```php
public function next(): void
```
Move the iterator to the next position. This method advances the internal iterator pointer to the next item in the collection sequence.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L197)
###### Returns
`void`
##### offsetExists
```php
public function offsetExists(mixed $offset): bool
```
Check if an offset exists in the collection. This method determines whether the collection contains an item at the specified offset position.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L209)
###### Parameters
| Name | Type | Description |
| --------- | ------- | --------------------------------- |
| `$offset` | `mixed` | The offset to check for existence |
###### Returns
`bool` — True if the offset exists, false otherwise
##### offsetGet
```php
public function offsetGet(mixed $offset): T|null
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L217)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`T` | `null`
##### offsetSet
```php
public function offsetSet(int|string|null $offset, T $value): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L226)
###### Parameters
| Name | Type | Description |
| --------- | ----------------------------------- | ----------- |
| `$offset` | `int` | `string` | `null` | |
| `$value` | `T` | |
###### Returns
`void`
##### offsetUnset
```php
public function offsetUnset(mixed $offset): void
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L232)
###### Parameters
| Name | Type | Description |
| --------- | ------- | ----------- |
| `$offset` | `mixed` | |
###### Returns
`void`
##### reduce
```php
public function reduce(U $initial, callable $callback): U
```
Reduce the collection to a single value using a callback function. This method iteratively applies a callback function to accumulate the collection items into a single value, starting with an initial value.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L246)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ---------------------------------------- |
| `$initial` | `U` | The initial value to start the reduction |
| `$callback` | `callable` | |
###### Returns
`U` — The final accumulated value
##### rewind
```php
public function rewind(): void
```
Reset the iterator to the beginning of the collection. This method moves the internal iterator pointer back to the first item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L255)
###### Returns
`void`
##### some
```php
public function some(callable $callback): bool
```
Check if at least one item in the collection matches the given condition. This method tests whether at least one item in the collection satisfies the provided callback function. Returns true if any item passes the test, false if all items fail.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L267)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`bool` — True if any item matches the condition, false otherwise
##### toArray
```php
public function toArray(): array<int|string, T>
```
Convert the collection to a standard PHP array. This method creates a native PHP array containing all items in the collection, preserving their order and indexes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L277)
###### Returns
`array<int` | `string, T>` — A standard PHP array containing all collection items
##### valid
```php
public function valid(): bool
```
Check if the current iterator position is valid. This method determines whether the current iterator position points to a valid item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L288)
###### Returns
`bool` — True if the current position is valid, false otherwise
##### withItems
```php
public function withItems(mixed $items): static
```
Create a new collection with the specified items. This method creates a fresh collection instance containing only the provided items, leaving the original collection unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Collections/IndexedCollectionInterface.php#L302)
###### Parameters
| Name | Type | Description |
| -------- | ----- | ----------- |
| `$items` | mixed | |
###### Returns
`static` — A new collection instance containing the specified items
<!-- End of evansims/openfga-php/docs/API/Models/Collections/UsersetsInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Enums/Consistency.md -->
### Consistency
Consistency levels for OpenFGA authorization queries. This enum defines the available consistency levels that control the trade-off between data consistency and query performance in OpenFGA operations. Different consistency levels affect how fresh the data needs to be when processing authorization checks.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`getDescription()`](#getdescription)
- [`prioritizesConsistency()`](#prioritizesconsistency)
- [`prioritizesPerformance()`](#prioritizesperformance)
</details>
#### Namespace
`OpenFGA\Models\Enums`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/Consistency.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| -------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HIGHER_CONSISTENCY` | `HIGHER_CONSISTENCY` | Prioritize data consistency over query performance. This option ensures that authorization checks are performed against the most up-to-date data, potentially at the cost of increased latency. Use when accuracy is more important than speed. |
| `MINIMIZE_LATENCY` | `MINIMIZE_LATENCY` | Prioritize query performance over data consistency. This option allows for faster authorization checks by potentially using slightly stale data. Use when speed is more important than having the absolute latest data. |
| `UNSPECIFIED` | `UNSPECIFIED` | Use the default consistency level determined by the OpenFGA server. This option delegates the consistency decision to the server's configuration, which may change based on deployment settings. |
#### Cases
| Name | Value | Description |
| -------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HIGHER_CONSISTENCY` | `HIGHER_CONSISTENCY` | Prioritize data consistency over query performance. This option ensures that authorization checks are performed against the most up-to-date data, potentially at the cost of increased latency. Use when accuracy is more important than speed. |
| `MINIMIZE_LATENCY` | `MINIMIZE_LATENCY` | Prioritize query performance over data consistency. This option allows for faster authorization checks by potentially using slightly stale data. Use when speed is more important than having the absolute latest data. |
| `UNSPECIFIED` | `UNSPECIFIED` | Use the default consistency level determined by the OpenFGA server. This option delegates the consistency decision to the server's configuration, which may change based on deployment settings. |
#### Methods
##### getDescription
```php
public function getDescription(): string
```
Get a user-friendly description of this consistency level. Provides a descriptive explanation of what this consistency level means for query behavior and performance characteristics.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/Consistency.php#L55)
###### Returns
`string` — A descriptive explanation of the consistency level
##### prioritizesConsistency
```php
public function prioritizesConsistency(): bool
```
Check if this consistency level prioritizes data freshness. Useful for determining if a query will potentially have higher latency in exchange for more up-to-date data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/Consistency.php#L72)
###### Returns
`bool` — True if consistency is prioritized over performance, false otherwise
##### prioritizesPerformance
```php
public function prioritizesPerformance(): bool
```
Check if this consistency level prioritizes query performance. Useful for determining if a query will potentially use stale data in exchange for better performance.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/Consistency.php#L88)
###### Returns
`bool` — True if performance is prioritized over consistency, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Enums/Consistency.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Enums/README.md -->
## Enums
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Models > Enums
Enumeration types for consistent value constraints across the SDK.
**Total Components:** 4
### Enumerations
| Name | Description |
|------|-------------|
| [`Consistency`](https://github.com/evansims/openfga-php/blob/main/./Consistency.md) | Consistency levels for OpenFGA authorization queries. This enum defines the available consistency... |
| [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/./SchemaVersion.md) | OpenFGA authorization model schema versions. This enum defines the supported schema versions for ... |
| [`TupleOperation`](https://github.com/evansims/openfga-php/blob/main/./TupleOperation.md) | Operations that can be performed on relationship tuples in OpenFGA. This enum defines the availab... |
| [`TypeName`](https://github.com/evansims/openfga-php/blob/main/./TypeName.md) | Data types supported in OpenFGA condition parameters. This enum defines the available data types ... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Models/Enums/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Enums/SchemaVersion.md -->
### SchemaVersion
OpenFGA authorization model schema versions. This enum defines the supported schema versions for authorization models in OpenFGA, ensuring compatibility between client libraries and the OpenFGA service. Each schema version represents a specific format and feature set for authorization models, with newer versions introducing enhanced capabilities while maintaining backward compatibility wherever possible. Schema versioning enables: - Gradual migration between OpenFGA versions - Feature availability validation - Compatibility checking between clients and servers - Forward and backward compatibility planning When creating authorization models, choose the appropriate schema version based on the features you need and the OpenFGA service version you're targeting. Newer schema versions provide access to the latest OpenFGA capabilities but may require minimum service versions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`compareTo()`](#compareto)
- [`getNumericVersion()`](#getnumericversion)
- [`isLatest()`](#islatest)
- [`isLegacy()`](#islegacy)
- [`supportsConditions()`](#supportsconditions)
</details>
#### Namespace
`OpenFGA\Models\Enums`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/SchemaVersion.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| ------ | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `V1_0` | `1.0` | Schema version 1.0 - Legacy authorization model format. This foundational schema version provides core relationship modeling capabilities including basic type definitions, relations, and usersets. While still supported for backward compatibility with existing deployments, this version has limitations compared to newer schema versions. Features available in v1.0: - Basic type definitions and relations - Simple userset operations (direct, union, intersection) - Fundamental relationship modeling Consider upgrading to v1.1 for access to advanced features like conditions and enhanced relationship modeling capabilities. |
| `V1_1` | `1.1` | Schema version 1.1 - Current standard authorization model format. This is the recommended schema version for new OpenFGA deployments, providing comprehensive authorization modeling capabilities including advanced features that enable sophisticated access control patterns. This version represents the current state of the art in OpenFGA authorization modeling. Enhanced features in v1.1: - Conditional relationships with runtime parameter evaluation - Advanced type definition metadata and configuration - Improved userset operations and relationship inheritance - Enhanced debugging and introspection capabilities - Full compatibility with all current OpenFGA service features Use this version for new projects and when migrating from v1.0 to access the latest OpenFGA capabilities and performance improvements. |
#### Cases
| Name | Value | Description |
| ------ | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `V1_0` | `1.0` | Schema version 1.0 - Legacy authorization model format. This foundational schema version provides core relationship modeling capabilities including basic type definitions, relations, and usersets. While still supported for backward compatibility with existing deployments, this version has limitations compared to newer schema versions. Features available in v1.0: - Basic type definitions and relations - Simple userset operations (direct, union, intersection) - Fundamental relationship modeling Consider upgrading to v1.1 for access to advanced features like conditions and enhanced relationship modeling capabilities. |
| `V1_1` | `1.1` | Schema version 1.1 - Current standard authorization model format. This is the recommended schema version for new OpenFGA deployments, providing comprehensive authorization modeling capabilities including advanced features that enable sophisticated access control patterns. This version represents the current state of the art in OpenFGA authorization modeling. Enhanced features in v1.1: - Conditional relationships with runtime parameter evaluation - Advanced type definition metadata and configuration - Improved userset operations and relationship inheritance - Enhanced debugging and introspection capabilities - Full compatibility with all current OpenFGA service features Use this version for new projects and when migrating from v1.0 to access the latest OpenFGA capabilities and performance improvements. |
#### Methods
##### compareTo
```php
public function compareTo(SchemaVersion $other): int
```
Compare this schema version with another version. Returns negative, zero, or positive value if this version is respectively less than, equal to, or greater than the compared version.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/SchemaVersion.php#L81)
###### Parameters
| Name | Type | Description |
| -------- | ----------------------------------- | ------------------------------ |
| `$other` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/SchemaVersion.md) | The version to compare against |
###### Returns
`int` — Comparison result (-1, 0, or 1)
##### getNumericVersion
```php
public function getNumericVersion(): float
```
Get the numeric version as a float for comparison operations. Useful for version comparison logic and feature detection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/SchemaVersion.php#L93)
###### Returns
`float` — The numeric representation of the schema version
##### isLatest
```php
public function isLatest(): bool
```
Check if this is the latest schema version. Useful for determining if an authorization model is using the most current feature set and capabilities.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/SchemaVersion.php#L106)
###### Returns
`bool` — True if this is the latest schema version, false otherwise
##### isLegacy
```php
public function isLegacy(): bool
```
Check if this is a legacy schema version. Legacy versions are still supported but may lack features available in newer versions. Consider upgrading for better functionality.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/SchemaVersion.php#L119)
###### Returns
`bool` — True if this is a legacy version, false otherwise
##### supportsConditions
```php
public function supportsConditions(): bool
```
Check if this schema version supports conditional relationships. Conditional relationships allow runtime parameter evaluation to determine relationship validity, enabling context-aware authorization decisions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/SchemaVersion.php#L135)
###### Returns
`bool` — True if conditional relationships are supported, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Enums/SchemaVersion.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Enums/TupleOperation.md -->
### TupleOperation
Operations that can be performed on relationship tuples in OpenFGA. This enum defines the available operations for managing relationship tuples through the OpenFGA write API. Tuples represent the actual relationships between users, objects, and relations that form the foundation of all authorization decisions. These operations enable dynamic management of authorization data by adding and removing relationships as your system evolves. Tuple operations are atomic and transactional, ensuring consistency in authorization data. They can be batched together in write requests to perform multiple relationship changes simultaneously, maintaining referential integrity across related permissions. These operations support: - Dynamic permission assignment and revocation - User lifecycle management (onboarding/offboarding) - Role-based access control updates - Temporary access grants and restrictions - Organizational structure changes
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`getDescription()`](#getdescription)
- [`grantsPermissions()`](#grantspermissions)
- [`isIdempotent()`](#isidempotent)
- [`revokesPermissions()`](#revokespermissions)
</details>
#### Namespace
`OpenFGA\Models\Enums`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TupleOperation.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| ------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `TUPLE_OPERATION_DELETE` | `TUPLE_OPERATION_DELETE` | Delete operation for removing existing relationship tuples. This operation removes an existing relationship tuple from the authorization store, effectively revoking the relationship between the specified user, object, and relation. The deletion is immediate and will affect subsequent authorization checks that depend on this relationship. Use cases for delete operations: - Revoking user permissions when access should be removed - User offboarding and access cleanup - Removing temporary access grants that have expired - Correcting incorrectly assigned permissions - Organizational changes that require permission updates Delete operations are idempotent - attempting to delete a non-existent tuple will not cause an error, making them safe for cleanup operations and ensuring consistent behavior in distributed environments. |
| `TUPLE_OPERATION_WRITE` | `TUPLE_OPERATION_WRITE` | Write operation for adding new relationship tuples. This operation adds a new relationship tuple to the authorization store, establishing a relationship between the specified user, object, and relation. The new relationship becomes immediately available for authorization checks and will be considered in all relevant permission evaluations. Use cases for write operations: - Granting users new permissions on resources - User onboarding and initial access setup - Dynamic role assignments and promotions - Sharing permissions and delegation scenarios - Creating group memberships and organizational relationships Write operations will overwrite existing tuples with the same key, ensuring that permission grants are idempotent and can be safely repeated without creating duplicate relationships. |
#### Cases
| Name | Value | Description |
| ------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `TUPLE_OPERATION_DELETE` | `TUPLE_OPERATION_DELETE` | Delete operation for removing existing relationship tuples. This operation removes an existing relationship tuple from the authorization store, effectively revoking the relationship between the specified user, object, and relation. The deletion is immediate and will affect subsequent authorization checks that depend on this relationship. Use cases for delete operations: - Revoking user permissions when access should be removed - User offboarding and access cleanup - Removing temporary access grants that have expired - Correcting incorrectly assigned permissions - Organizational changes that require permission updates Delete operations are idempotent - attempting to delete a non-existent tuple will not cause an error, making them safe for cleanup operations and ensuring consistent behavior in distributed environments. |
| `TUPLE_OPERATION_WRITE` | `TUPLE_OPERATION_WRITE` | Write operation for adding new relationship tuples. This operation adds a new relationship tuple to the authorization store, establishing a relationship between the specified user, object, and relation. The new relationship becomes immediately available for authorization checks and will be considered in all relevant permission evaluations. Use cases for write operations: - Granting users new permissions on resources - User onboarding and initial access setup - Dynamic role assignments and promotions - Sharing permissions and delegation scenarios - Creating group memberships and organizational relationships Write operations will overwrite existing tuples with the same key, ensuring that permission grants are idempotent and can be safely repeated without creating duplicate relationships. |
#### Methods
##### getDescription
```php
public function getDescription(): string
```
Get a user-friendly description of what this operation does. Provides a clear explanation of the operation's effect on authorization data, useful for logging, auditing, and user interfaces.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TupleOperation.php#L84)
###### Returns
`string` — A descriptive explanation of the operation
##### grantsPermissions
```php
public function grantsPermissions(): bool
```
Check if this operation adds permissions to the authorization store. Useful for understanding whether an operation will grant new access or capabilities to users within the system.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TupleOperation.php#L100)
###### Returns
`bool` — True if the operation adds permissions, false otherwise
##### isIdempotent
```php
public function isIdempotent(): true
```
Check if this operation is safe to retry in case of failures. Idempotent operations can be safely retried without causing unintended side effects, making them suitable for retry logic and distributed systems.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TupleOperation.php#L116)
###### Returns
`true` — True if the operation is idempotent, false otherwise
##### revokesPermissions
```php
public function revokesPermissions(): bool
```
Check if this operation removes permissions from the authorization store. Useful for understanding whether an operation will revoke existing access or capabilities from users within the system.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TupleOperation.php#L129)
###### Returns
`bool` — True if the operation removes permissions, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Enums/TupleOperation.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Enums/TypeName.md -->
### TypeName
Data types supported in OpenFGA condition parameters. This enum defines the available data types that can be used for parameters in OpenFGA authorization model conditions. These types enable type-safe evaluation of conditional logic within authorization rules.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`getPhpType()`](#getphptype)
- [`isCollection()`](#iscollection)
- [`isFlexible()`](#isflexible)
- [`isNumeric()`](#isnumeric)
- [`isTemporal()`](#istemporal)
</details>
#### Namespace
`OpenFGA\Models\Enums`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TypeName.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| ------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ANY` | `TYPE_NAME_ANY` | Any type - accepts values of any supported data type. This type provides maximum flexibility by accepting any value, useful for generic parameters or when the exact type is determined at runtime. |
| `BOOL` | `TYPE_NAME_BOOL` | Boolean type for true/false values. Used for parameters that represent binary states or flags in authorization conditions. |
| `DOUBLE` | `TYPE_NAME_DOUBLE` | Double-precision floating-point number type. Used for parameters that require decimal precision, such as monetary amounts or scientific calculations. |
| `DURATION` | `TYPE_NAME_DURATION` | Duration type for time spans. Used for parameters representing periods of time, such as session timeouts or validity periods. |
| `INT` | `TYPE_NAME_INT` | Signed integer type for whole numbers. Used for parameters that represent counts, IDs, or other whole number values that can be negative. |
| `IPADDRESS` | `TYPE_NAME_IPADDRESS` | IP address type for network addresses. Used for parameters representing IPv4 or IPv6 addresses in network-based authorization conditions. |
| `LIST` | `TYPE_NAME_LIST` | List type for ordered collections of values. Used for parameters that contain multiple values of the same or different types in a specific order. |
| `MAP` | `TYPE_NAME_MAP` | Map type for key-value collections. Used for parameters that represent associative arrays or dictionary-like structures with named properties. |
| `STRING` | `TYPE_NAME_STRING` | String type for textual data. Used for parameters containing text values such as names, descriptions, or other string-based identifiers. |
| `TIMESTAMP` | `TYPE_NAME_TIMESTAMP` | Timestamp type for specific points in time. Used for parameters representing exact moments, such as creation dates or expiration times. |
| `UINT` | `TYPE_NAME_UINT` | Unsigned integer type for non-negative whole numbers. Used for parameters that represent counts, sizes, or other whole number values that cannot be negative. |
| `UNSPECIFIED` | `TYPE_NAME_UNSPECIFIED` | Unspecified type - type is not explicitly defined. Used when the parameter type is determined by context or when type checking is deferred to runtime. |
#### Cases
| Name | Value | Description |
| ------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ANY` | `TYPE_NAME_ANY` | Any type - accepts values of any supported data type. This type provides maximum flexibility by accepting any value, useful for generic parameters or when the exact type is determined at runtime. |
| `BOOL` | `TYPE_NAME_BOOL` | Boolean type for true/false values. Used for parameters that represent binary states or flags in authorization conditions. |
| `DOUBLE` | `TYPE_NAME_DOUBLE` | Double-precision floating-point number type. Used for parameters that require decimal precision, such as monetary amounts or scientific calculations. |
| `DURATION` | `TYPE_NAME_DURATION` | Duration type for time spans. Used for parameters representing periods of time, such as session timeouts or validity periods. |
| `INT` | `TYPE_NAME_INT` | Signed integer type for whole numbers. Used for parameters that represent counts, IDs, or other whole number values that can be negative. |
| `IPADDRESS` | `TYPE_NAME_IPADDRESS` | IP address type for network addresses. Used for parameters representing IPv4 or IPv6 addresses in network-based authorization conditions. |
| `LIST` | `TYPE_NAME_LIST` | List type for ordered collections of values. Used for parameters that contain multiple values of the same or different types in a specific order. |
| `MAP` | `TYPE_NAME_MAP` | Map type for key-value collections. Used for parameters that represent associative arrays or dictionary-like structures with named properties. |
| `STRING` | `TYPE_NAME_STRING` | String type for textual data. Used for parameters containing text values such as names, descriptions, or other string-based identifiers. |
| `TIMESTAMP` | `TYPE_NAME_TIMESTAMP` | Timestamp type for specific points in time. Used for parameters representing exact moments, such as creation dates or expiration times. |
| `UINT` | `TYPE_NAME_UINT` | Unsigned integer type for non-negative whole numbers. Used for parameters that represent counts, sizes, or other whole number values that cannot be negative. |
| `UNSPECIFIED` | `TYPE_NAME_UNSPECIFIED` | Unspecified type - type is not explicitly defined. Used when the parameter type is determined by context or when type checking is deferred to runtime. |
#### Methods
##### getPhpType
```php
public function getPhpType(): string
```
Get the corresponding PHP type for this OpenFGA type. Returns the equivalent PHP type name that would be used for values of this type in PHP code.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TypeName.php#L122)
###### Returns
`string` — The PHP type name
##### isCollection
```php
public function isCollection(): bool
```
Check if this type represents a collection of values. Useful for determining if iteration or collection-specific operations can be performed on parameters of this type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TypeName.php#L148)
###### Returns
`bool` — True if the type is a collection, false otherwise
##### isFlexible
```php
public function isFlexible(): bool
```
Check if this type accepts flexible or dynamic values. Useful for determining if runtime type checking is needed or if strict type validation can be bypassed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TypeName.php#L166)
###### Returns
`bool` — True if the type is flexible, false otherwise
##### isNumeric
```php
public function isNumeric(): bool
```
Check if this type represents a numeric value. Useful for validation and type checking in condition parameter processing where numeric operations are involved.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TypeName.php#L184)
###### Returns
`bool` — True if the type is numeric, false otherwise
##### isTemporal
```php
public function isTemporal(): bool
```
Check if this type represents a temporal value. Useful for determining if time-based operations can be performed on parameters of this type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Enums/TypeName.php#L202)
###### Returns
`bool` — True if the type is temporal, false otherwise
<!-- End of evansims/openfga-php/docs/API/Models/Enums/TypeName.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Assertion.md -->
### Assertion
Tests whether your authorization model behaves correctly for specific scenarios. Assertions are test cases that verify your authorization rules work as expected. Each assertion checks if a specific authorization question (like "can user:anne read document:budget") returns the expected result (true for granted, false for denied). Use assertions to validate your authorization model during development and catch permission logic errors before they reach production. They're especially valuable when making changes to complex authorization rules.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getExpectation()`](#getexpectation)
- [`getTupleKey()`](#gettuplekey)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Assertion.php)
#### Implements
- [`AssertionInterface`](https://github.com/evansims/openfga-php/blob/main/AssertionInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [AssertionInterface](https://github.com/evansims/openfga-php/blob/main/Models/AssertionInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ----------- | ----------- |
| `OPENAPI_MODEL` | `Assertion` | |
#### Methods
##### getContext
```php
public function getContext(): ?array
```
Get the context data for evaluating ABAC conditions. Context provides additional information that can be used when evaluating attribute-based access control (ABAC) conditions. This might include user attributes, resource properties, or environmental factors like time of day.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Assertion.php#L176)
###### Returns
`array` | `null`
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the contextual tuples for this assertion. Contextual tuples provide additional relationship data that should be considered when evaluating the assertion. These are temporary relationships that exist only for the duration of the authorization check, useful for testing "what-if" scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Assertion.php#L185)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null`
##### getExpectation
```php
public function getExpectation(): bool
```
Get the expected result for this assertion. The expectation defines whether the authorization check should return true (access granted) or false (access denied). This is what the assertion will be tested against.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Assertion.php#L194)
###### Returns
`bool` — True if access should be granted, false if access should be denied
##### getTupleKey
```php
public function getTupleKey(): OpenFGA\Models\AssertionTupleKeyInterface
```
Get the tuple key that defines what to test. The tuple key specifies the exact authorization question to ask: "Does user X have relation Y on object Z?" This is the core of what the assertion is testing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Assertion.php#L203)
###### Returns
[`AssertionTupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/AssertionTupleKeyInterface.md) — The tuple key defining the authorization question
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Assertion.php#L212)
###### Returns
`array`
##### schema
*<small>Implements Models\AssertionInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Assertion.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/AssertionInterface.md -->
### AssertionInterface
Represents an assertion used to test authorization model correctness. Assertions are test cases that verify whether specific authorization decisions should be allowed or denied. They are essential for validating authorization models and ensuring they behave as expected. Each assertion includes a tuple key to test, the expected result, and optional contextual information for complex scenarios.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getExpectation()`](#getexpectation)
- [`getTupleKey()`](#gettuplekey)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Assertion](https://github.com/evansims/openfga-php/blob/main/Models/Assertion.md) (implementation)
#### Methods
##### getContext
```php
public function getContext(): ?array
```
Get the context data for evaluating ABAC conditions. Context provides additional information that can be used when evaluating attribute-based access control (ABAC) conditions. This might include user attributes, resource properties, or environmental factors like time of day.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionInterface.php#L32)
###### Returns
`array` | `null`
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the contextual tuples for this assertion. Contextual tuples provide additional relationship data that should be considered when evaluating the assertion. These are temporary relationships that exist only for the duration of the authorization check, useful for testing "what-if" scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionInterface.php#L44)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null`
##### getExpectation
```php
public function getExpectation(): bool
```
Get the expected result for this assertion. The expectation defines whether the authorization check should return true (access granted) or false (access denied). This is what the assertion will be tested against.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionInterface.php#L55)
###### Returns
`bool` — True if access should be granted, false if access should be denied
##### getTupleKey
```php
public function getTupleKey(): AssertionTupleKeyInterface
```
Get the tuple key that defines what to test. The tuple key specifies the exact authorization question to ask: "Does user X have relation Y on object Z?" This is the core of what the assertion is testing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionInterface.php#L66)
###### Returns
[`AssertionTupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/AssertionTupleKeyInterface.md) — The tuple key defining the authorization question
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionInterface.php#L77)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/AssertionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/AssertionTupleKey.md -->
### AssertionTupleKey
Represents a tuple key used for testing authorization model assertions. An AssertionTupleKey defines the specific user, relation, and object combination that should be tested in authorization model assertions. This is used to verify that your authorization model behaves correctly by testing whether specific authorization questions return the expected results. Use this when creating test cases to validate your authorization rules and ensure your permission model works as intended.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`getUser()`](#getuser)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKey.php)
#### Implements
- [`AssertionTupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/AssertionTupleKeyInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [AssertionTupleKeyInterface](https://github.com/evansims/openfga-php/blob/main/Models/AssertionTupleKeyInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------------- | ----------- |
| `OPENAPI_MODEL` | `AssertionTupleKey` | |
#### Methods
##### getObject
```php
public function getObject(): string
```
Get the object being tested in the assertion. This represents the resource or entity that the assertion is testing access to. In assertion testing, this is the object part of the tuple being validated against the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKey.php#L59)
###### Returns
`string` — The object identifier being tested
##### getRelation
```php
public function getRelation(): string
```
Get the relation being tested in the assertion. This represents the type of relationship or permission being tested in the assertion. It defines what kind of access is being validated between the user and object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKey.php#L68)
###### Returns
`string` — The relation name being tested
##### getUser
```php
public function getUser(): string
```
Get the user being tested in the assertion. This represents the subject (user, group, role, etc.) whose access is being tested in the assertion. It's the entity for which we're validating whether they have the specified relation to the object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKey.php#L77)
###### Returns
`string` — The user identifier being tested
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKey.php#L86)
###### Returns
`array`
##### schema
*<small>Implements Models\AssertionTupleKeyInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/AssertionTupleKey.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/AssertionTupleKeyInterface.md -->
### AssertionTupleKeyInterface
Defines the contract for assertion tuple keys used in authorization model testing. An assertion tuple key specifies the user, relation, and object combination that should be tested in authorization model assertions. This is used to verify that your authorization model behaves correctly for specific scenarios. Use this when creating test cases to validate your authorization rules and ensure your permission model works as expected.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`getUser()`](#getuser)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKeyInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [AssertionTupleKey](https://github.com/evansims/openfga-php/blob/main/Models/AssertionTupleKey.md) (implementation)
#### Methods
##### getObject
```php
public function getObject(): string
```
Get the object being tested in the assertion. This represents the resource or entity that the assertion is testing access to. In assertion testing, this is the object part of the tuple being validated against the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKeyInterface.php#L30)
###### Returns
`string` — The object identifier being tested
##### getRelation
```php
public function getRelation(): string
```
Get the relation being tested in the assertion. This represents the type of relationship or permission being tested in the assertion. It defines what kind of access is being validated between the user and object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKeyInterface.php#L41)
###### Returns
`string` — The relation name being tested
##### getUser
```php
public function getUser(): string
```
Get the user being tested in the assertion. This represents the subject (user, group, role, etc.) whose access is being tested in the assertion. It's the entity for which we're validating whether they have the specified relation to the object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKeyInterface.php#L52)
###### Returns
`string` — The user identifier being tested
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AssertionTupleKeyInterface.php#L62)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/AssertionTupleKeyInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/AuthorizationModel.md -->
### AuthorizationModel
Defines the authorization rules and relationships for your application. An AuthorizationModel is the core configuration that tells OpenFGA how permissions work in your system. It defines object types (like documents, folders), relationships (like owner, editor, viewer), and the rules for how those relationships grant access. Think of this as your application's "permission blueprint" - it describes all the ways users can be related to objects and what those relationships mean for access control decisions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`dsl()`](#dsl)
- [`getConditions()`](#getconditions)
- [`getId()`](#getid)
- [`getSchemaVersion()`](#getschemaversion)
- [`getTypeDefinitions()`](#gettypedefinitions)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModel.php)
#### Implements
- [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/AuthorizationModelInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [AuthorizationModelInterface](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) (interface)
- [AuthorizationModels](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AuthorizationModels.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | -------------------- | ----------- |
| `OPENAPI_MODEL` | `AuthorizationModel` | |
#### Methods
##### dsl
```php
public function dsl(): string
```
Generate a DSL (Domain Specific Language) representation of this authorization model. The DSL provides a human-readable, text-based format for expressing authorization models that is easier to understand, review, and modify than raw JSON. The DSL format uses a syntax similar to configuration languages, making it accessible to both developers and non-technical stakeholders who need to understand or modify permission structures. The DSL representation includes: - Type definitions with their relations and inheritance rules - Condition expressions and parameters - Human-readable relation definitions and computed permissions - Comments and formatting that enhance comprehension This format is particularly valuable for: - Documentation and code reviews - Version control and change tracking - Model debugging and testing - Administrative interfaces and tooling
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModel.php#L73)
###### Returns
`string` — The authorization model expressed in OpenFGA DSL format for human readability
##### getConditions
```php
public function getConditions(): ?OpenFGA\Models\Collections\ConditionsInterface
```
Get the conditions defined in this authorization model. Conditions enable attribute-based access control (ABAC) by allowing relationships to be conditional based on runtime context and parameters. When conditions are present in the model, they can be referenced in relationship tuples to create dynamic authorization rules that consider factors such as: - Time-based restrictions (business hours, expiration dates) - Resource attributes (document classification, geographic location) - User context (department, role level, current project) - Environmental factors (IP address, device type, authentication method) Conditions are evaluated during authorization checks, and relationships with conditions are only considered valid when the condition evaluates to true given the current context parameters.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModel.php#L82)
###### Returns
[`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` — The collection of reusable conditions defined in this model, or null if no conditions are defined
##### getId
```php
public function getId(): string
```
Get the unique identifier for this authorization model. The model ID serves as a unique identifier for this specific version of the authorization model within the OpenFGA system. This ID is generated by the OpenFGA service when the model is created and is used to: - Reference this model in API operations - Track model versions and deployment history - Ensure consistency across different services and environments - Enable model rollbacks and A/B testing scenarios Each model ID is unique within a store, allowing multiple model versions to coexist and enabling gradual migration between authorization schemas.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModel.php#L91)
###### Returns
`string` — The globally unique identifier for this authorization model version
##### getSchemaVersion
```php
public function getSchemaVersion(): OpenFGA\Models\Enums\SchemaVersion
```
Get the schema version of this authorization model. The schema version indicates which version of the OpenFGA authorization model specification this model conforms to. Different schema versions may support different features, syntax variations, or behavioral semantics. This version information ensures: - Proper interpretation of model structures and syntax - Compatibility checking between client and server versions - Feature availability and validation logic - Migration paths between different OpenFGA versions The schema version enables the OpenFGA service to correctly parse and execute authorization logic according to the appropriate specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModel.php#L100)
###### Returns
[`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) — The schema version enumeration indicating the model format specification
##### getTypeDefinitions
```php
public function getTypeDefinitions(): OpenFGA\Models\Collections\TypeDefinitionsInterface
```
Get the type definitions that define the structure of this authorization model. Type definitions form the core structure of an authorization model by specifying: - The types of objects that exist in your system (documents, users, folders, etc.) - The relationships that can exist between users and those object types - How permissions are computed and inherited through relationship chains - The rules that govern complex authorization scenarios Each type definition includes relations that describe the various ways users can be associated with objects of that type. Relations can be direct (simple assignments) or computed (derived from other relationships), enabling sophisticated permission hierarchies and inheritance patterns. Type definitions are the foundation that OpenFGA uses to understand your domain model and execute authorization queries efficiently.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModel.php#L109)
###### Returns
[`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) — The collection of type definitions that structure this authorization model
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the authorization model for JSON encoding. This method prepares the complete authorization model data for API communication with the OpenFGA service, converting all components into the format specified by the OpenFGA API. The serialization includes: - Model identification and versioning information - Complete type definitions with relations and metadata - Optional conditions with expressions and parameters - All nested structures properly formatted for JSON transmission The resulting structure is suitable for creating new authorization models, updating existing models, or storing model definitions in external systems. All data is formatted according to the OpenFGA API specification to ensure compatibility and correct interpretation by the authorization service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModel.php#L118)
###### Returns
`array`
##### schema
*<small>Implements Models\AuthorizationModelInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/AuthorizationModel.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/AuthorizationModelInterface.md -->
### AuthorizationModelInterface
Represents an OpenFGA authorization model that defines permission structures. Authorization models are the core configuration that defines how permissions work in your application. They specify the types of objects in your system, the relationships that can exist between users and those objects, and the rules that govern how permissions are computed and inherited. An authorization model consists of: - Type definitions that describe object types and their possible relations - Optional conditions that enable context-based authorization decisions - Schema version information for compatibility and evolution - Unique model ID for versioning and deployment tracking Authorization models serve as the blueprint for all authorization decisions, defining the permission logic that OpenFGA uses when evaluating check requests. They can be expressed in both JSON format (for API operations) and DSL format (for human readability and management). Models support versioning, allowing you to evolve your authorization logic over time while maintaining compatibility with existing data and applications. Each model version is immutable once created, ensuring consistent behavior and enabling safe rollbacks when needed.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`dsl()`](#dsl)
- [`getConditions()`](#getconditions)
- [`getId()`](#getid)
- [`getSchemaVersion()`](#getschemaversion)
- [`getTypeDefinitions()`](#gettypedefinitions)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModelInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [AuthorizationModel](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModel.md) (implementation)
#### Methods
##### dsl
```php
public function dsl(): string
```
Generate a DSL (Domain Specific Language) representation of this authorization model. The DSL provides a human-readable, text-based format for expressing authorization models that is easier to understand, review, and modify than raw JSON. The DSL format uses a syntax similar to configuration languages, making it accessible to both developers and non-technical stakeholders who need to understand or modify permission structures. The DSL representation includes: - Type definitions with their relations and inheritance rules - Condition expressions and parameters - Human-readable relation definitions and computed permissions - Comments and formatting that enhance comprehension This format is particularly valuable for: - Documentation and code reviews - Version control and change tracking - Model debugging and testing - Administrative interfaces and tooling
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModelInterface.php#L64)
###### Returns
`string` — The authorization model expressed in OpenFGA DSL format for human readability
##### getConditions
```php
public function getConditions(): ConditionsInterface|null
```
Get the conditions defined in this authorization model. Conditions enable attribute-based access control (ABAC) by allowing relationships to be conditional based on runtime context and parameters. When conditions are present in the model, they can be referenced in relationship tuples to create dynamic authorization rules that consider factors such as: - Time-based restrictions (business hours, expiration dates) - Resource attributes (document classification, geographic location) - User context (department, role level, current project) - Environmental factors (IP address, device type, authentication method) Conditions are evaluated during authorization checks, and relationships with conditions are only considered valid when the condition evaluates to true given the current context parameters.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModelInterface.php#L84)
###### Returns
[`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` — The collection of reusable conditions defined in this model, or null if no conditions are defined
##### getId
```php
public function getId(): string
```
Get the unique identifier for this authorization model. The model ID serves as a unique identifier for this specific version of the authorization model within the OpenFGA system. This ID is generated by the OpenFGA service when the model is created and is used to: - Reference this model in API operations - Track model versions and deployment history - Ensure consistency across different services and environments - Enable model rollbacks and A/B testing scenarios Each model ID is unique within a store, allowing multiple model versions to coexist and enabling gradual migration between authorization schemas.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModelInterface.php#L102)
###### Returns
`string` — The globally unique identifier for this authorization model version
##### getSchemaVersion
```php
public function getSchemaVersion(): SchemaVersion
```
Get the schema version of this authorization model. The schema version indicates which version of the OpenFGA authorization model specification this model conforms to. Different schema versions may support different features, syntax variations, or behavioral semantics. This version information ensures: - Proper interpretation of model structures and syntax - Compatibility checking between client and server versions - Feature availability and validation logic - Migration paths between different OpenFGA versions The schema version enables the OpenFGA service to correctly parse and execute authorization logic according to the appropriate specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModelInterface.php#L121)
###### Returns
[`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) — The schema version enumeration indicating the model format specification
##### getTypeDefinitions
```php
public function getTypeDefinitions(): TypeDefinitionsInterface
```
Get the type definitions that define the structure of this authorization model. Type definitions form the core structure of an authorization model by specifying: - The types of objects that exist in your system (documents, users, folders, etc.) - The relationships that can exist between users and those object types - How permissions are computed and inherited through relationship chains - The rules that govern complex authorization scenarios Each type definition includes relations that describe the various ways users can be associated with objects of that type. Relations can be direct (simple assignments) or computed (derived from other relationships), enabling sophisticated permission hierarchies and inheritance patterns. Type definitions are the foundation that OpenFGA uses to understand your domain model and execute authorization queries efficiently.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModelInterface.php#L142)
###### Returns
[`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) — The collection of type definitions that structure this authorization model
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the authorization model for JSON encoding. This method prepares the complete authorization model data for API communication with the OpenFGA service, converting all components into the format specified by the OpenFGA API. The serialization includes: - Model identification and versioning information - Complete type definitions with relations and metadata - Optional conditions with expressions and parameters - All nested structures properly formatted for JSON transmission The resulting structure is suitable for creating new authorization models, updating existing models, or storing model definitions in external systems. All data is formatted according to the OpenFGA API specification to ensure compatibility and correct interpretation by the authorization service.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/AuthorizationModelInterface.php#L168)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/AuthorizationModelInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchCheckItem.md -->
### BatchCheckItem
Represents a single item in a batch check request. Each batch check item contains a tuple key to check, an optional context, optional contextual tuples, and a correlation ID to map the result back to this specific check.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getCorrelationId()`](#getcorrelationid)
- [`getTupleKey()`](#gettuplekey)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
- [`toArray()`](#toarray)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItem.php)
#### Implements
- [`BatchCheckItemInterface`](https://github.com/evansims/openfga-php/blob/main/BatchCheckItemInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [BatchCheckItemInterface](https://github.com/evansims/openfga-php/blob/main/Models/BatchCheckItemInterface.md) (interface)
- [BatchCheckItems](https://github.com/evansims/openfga-php/blob/main/Models/Collections/BatchCheckItems.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ---------------- | ----------- |
| `OPENAPI_MODEL` | `BatchCheckItem` | |
#### Methods
##### getContext
```php
public function getContext(): ?object
```
Get the context object for this check. This provides additional context data that can be used by conditions in the authorization model during evaluation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItem.php#L195)
###### Returns
`object` | `null`
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the contextual tuples for this check. These are additional tuples that are evaluated only for this specific check and are not persisted in the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItem.php#L204)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null`
##### getCorrelationId
```php
public function getCorrelationId(): string
```
Get the correlation ID for this batch check item. This unique identifier maps the result back to this specific check. Must be alphanumeric characters or hyphens, maximum 36 characters.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItem.php#L213)
###### Returns
`string` — The correlation ID
##### getTupleKey
```php
public function getTupleKey(): OpenFGA\Models\TupleKeyInterface
```
Get the tuple key to be checked. This defines the user, relation, and object for the authorization check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItem.php#L222)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeyInterface.md) — The tuple key for this check
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItem.php#L233)
###### Returns
`array<`string`, `mixed`>`
##### schema
*<small>Implements Models\BatchCheckItemInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
##### toArray
```php
public function toArray(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItem.php#L248)
###### Returns
`array<`string`, `mixed`>`
<!-- End of evansims/openfga-php/docs/API/Models/BatchCheckItem.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchCheckItemInterface.md -->
### BatchCheckItemInterface
Represents a single item in a batch check request. Each batch check item contains a tuple key to check, an optional context, optional contextual tuples, and a correlation ID to map the result back to this specific check. The correlation ID must be unique within the batch and follow the pattern: alphanumeric characters or hyphens, maximum 36 characters.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getCorrelationId()`](#getcorrelationid)
- [`getTupleKey()`](#gettuplekey)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItemInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [BatchCheckItem](https://github.com/evansims/openfga-php/blob/main/Models/BatchCheckItem.md) (implementation)
#### Methods
##### getContext
```php
public function getContext(): ?object
```
Get the context object for this check. This provides additional context data that can be used by conditions in the authorization model during evaluation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItemInterface.php#L31)
###### Returns
`object` | `null`
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the contextual tuples for this check. These are additional tuples that are evaluated only for this specific check and are not persisted in the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItemInterface.php#L41)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null`
##### getCorrelationId
```php
public function getCorrelationId(): string
```
Get the correlation ID for this batch check item. This unique identifier maps the result back to this specific check. Must be alphanumeric characters or hyphens, maximum 36 characters.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItemInterface.php#L51)
###### Returns
`string` — The correlation ID
##### getTupleKey
```php
public function getTupleKey(): TupleKeyInterface
```
Get the tuple key to be checked. This defines the user, relation, and object for the authorization check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckItemInterface.php#L60)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeyInterface.md) — The tuple key for this check
##### jsonSerialize
```php
public function jsonSerialize()
```
<!-- End of evansims/openfga-php/docs/API/Models/BatchCheckItemInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchCheckSingleResult.md -->
### BatchCheckSingleResult
Represents the result of a single check within a batch check response. Each result contains whether the check was allowed and any error information if the check failed to complete successfully.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getAllowed()`](#getallowed)
- [`getError()`](#geterror)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
- [`toArray()`](#toarray)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResult.php)
#### Implements
- [`BatchCheckSingleResultInterface`](https://github.com/evansims/openfga-php/blob/main/BatchCheckSingleResultInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [BatchCheckSingleResultInterface](https://github.com/evansims/openfga-php/blob/main/Models/BatchCheckSingleResultInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------------------ | ----------- |
| `OPENAPI_MODEL` | `BatchCheckSingleResult` | |
#### Methods
##### getAllowed
```php
public function getAllowed(): ?bool
```
Get whether this check was allowed. Returns true if the user has the specified relationship with the object, false if they don't, or null if the check encountered an error.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResult.php#L91)
###### Returns
`bool` | `null`
##### getError
```php
public function getError(): ?object
```
Get any error that occurred during this check. Returns error information if the check failed to complete successfully, or null if the check completed without errors.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResult.php#L100)
###### Returns
`object` | `null`
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResult.php#L111)
###### Returns
`array<`string`, `mixed`>`
##### schema
*<small>Implements Models\BatchCheckSingleResultInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
##### toArray
```php
public function toArray(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResult.php#L124)
###### Returns
`array<`string`, `mixed`>`
<!-- End of evansims/openfga-php/docs/API/Models/BatchCheckSingleResult.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchCheckSingleResultInterface.md -->
### BatchCheckSingleResultInterface
Represents the result of a single check within a batch check response. Each result contains whether the check was allowed and any error information if the check failed to complete successfully.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAllowed()`](#getallowed)
- [`getError()`](#geterror)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResultInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [BatchCheckSingleResult](https://github.com/evansims/openfga-php/blob/main/Models/BatchCheckSingleResult.md) (implementation)
#### Methods
##### getAllowed
```php
public function getAllowed(): ?bool
```
Get whether this check was allowed. Returns true if the user has the specified relationship with the object, false if they don't, or null if the check encountered an error.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResultInterface.php#L25)
###### Returns
`bool` | `null`
##### getError
```php
public function getError(): ?object
```
Get any error that occurred during this check. Returns error information if the check failed to complete successfully, or null if the check completed without errors.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchCheckSingleResultInterface.php#L35)
###### Returns
`object` | `null`
##### jsonSerialize
```php
public function jsonSerialize()
```
<!-- End of evansims/openfga-php/docs/API/Models/BatchCheckSingleResultInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchTupleOperation.md -->
### BatchTupleOperation
Represents a batch tuple operation containing both writes and deletes. This model organizes tuple operations for batch processing, allowing you to specify both tuples to write and tuples to delete in a single operation. The batch processor will automatically chunk these operations to respect API limits while maintaining the grouping of related changes.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`chunk()`](#chunk)
- [`getDeletes()`](#getdeletes)
- [`getTotalOperations()`](#gettotaloperations)
- [`getWrites()`](#getwrites)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`requiresChunking()`](#requireschunking)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php)
#### Implements
- [`BatchTupleOperationInterface`](https://github.com/evansims/openfga-php/blob/main/BatchTupleOperationInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [BatchTupleOperationInterface](https://github.com/evansims/openfga-php/blob/main/Models/BatchTupleOperationInterface.md) (interface)
#### Constants
| Name | Value | Description |
| ------------------------ | --------------------- | ------------------------------------------------- |
| `MAX_TUPLES_PER_REQUEST` | `100` | Maximum number of tuples allowed per API request. |
| `OPENAPI_MODEL` | `BatchTupleOperation` | |
#### Methods
##### chunk
```php
public function chunk(int $chunkSize = 100): array
```
Split this operation into smaller chunks that respect API limits. If the operation doesn't require chunking, returns an array containing only this operation. Otherwise, splits the writes and deletes across multiple operations to stay within the specified chunk size.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php#L71)
###### Parameters
| Name | Type | Description |
| ------------ | ----- | --------------------------------------------- |
| `$chunkSize` | `int` | Maximum tuples per chunk (default: API limit) |
###### Returns
`array` — Array of operations, each within the chunk size
##### getDeletes
```php
public function getDeletes(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the tuples to delete in this operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php#L132)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of tuples to delete, or null if none
##### getTotalOperations
```php
public function getTotalOperations(): int
```
Get the total number of operations (writes + deletes).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php#L141)
###### Returns
`int` — Total count of tuples to be processed
##### getWrites
```php
public function getWrites(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the tuples to write in this operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php#L153)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of tuples to write, or null if none
##### isEmpty
```php
public function isEmpty(): bool
```
Check if this operation is empty (no writes or deletes).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php#L162)
###### Returns
`bool` — True if no operations are defined
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php#L173)
###### Returns
`array<`string`, `mixed`>`
##### requiresChunking
```php
public function requiresChunking(int $chunkSize = 100): bool
```
Check if this operation requires chunking due to size limits.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperation.php#L185)
###### Parameters
| Name | Type | Description |
| ------------ | ----- | --------------------------------------------- |
| `$chunkSize` | `int` | Maximum tuples per chunk (default: API limit) |
###### Returns
`bool` — True if the operation exceeds the specified chunk size
##### schema
*<small>Implements Models\BatchTupleOperationInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the JSON schema for this model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php#L25)
###### Returns
`SchemaInterface` — The schema definition
<!-- End of evansims/openfga-php/docs/API/Models/BatchTupleOperation.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchTupleOperationInterface.md -->
### BatchTupleOperationInterface
Interface for batch tuple operations. Defines the contract for organizing tuple writes and deletes into batches that can be processed efficiently while respecting API limitations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`chunk()`](#chunk)
- [`getDeletes()`](#getdeletes)
- [`getTotalOperations()`](#gettotaloperations)
- [`getWrites()`](#getwrites)
- [`isEmpty()`](#isempty)
- [`jsonSerialize()`](#jsonserialize)
- [`requiresChunking()`](#requireschunking)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [BatchTupleOperation](https://github.com/evansims/openfga-php/blob/main/Models/BatchTupleOperation.md) (implementation)
#### Methods
##### chunk
```php
public function chunk(int $chunkSize = 100): array<BatchTupleOperationInterface>
```
Split this operation into smaller chunks that respect API limits. If the operation doesn't require chunking, returns an array containing only this operation. Otherwise, splits the writes and deletes across multiple operations to stay within the specified chunk size.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php#L37)
###### Parameters
| Name | Type | Description |
| ------------ | ----- | --------------------------------------------- |
| `$chunkSize` | `int` | Maximum tuples per chunk (default: API limit) |
###### Returns
`array<[`BatchTupleOperationInterface`](https://github.com/evansims/openfga-php/blob/main/BatchTupleOperationInterface.md)>` — Array of operations, each within the chunk size
##### getDeletes
```php
public function getDeletes(): TupleKeysInterface|null
```
Get the tuples to delete in this operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php#L44)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of tuples to delete, or null if none
##### getTotalOperations
```php
public function getTotalOperations(): int
```
Get the total number of operations (writes + deletes).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php#L51)
###### Returns
`int` — Total count of tuples to be processed
##### getWrites
```php
public function getWrites(): TupleKeysInterface|null
```
Get the tuples to write in this operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php#L58)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of tuples to write, or null if none
##### isEmpty
```php
public function isEmpty(): bool
```
Check if this operation is empty (no writes or deletes).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php#L65)
###### Returns
`bool` — True if no operations are defined
##### jsonSerialize
```php
public function jsonSerialize()
```
##### requiresChunking
```php
public function requiresChunking(int $chunkSize = 100): bool
```
Check if this operation requires chunking due to size limits.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleOperationInterface.php#L73)
###### Parameters
| Name | Type | Description |
| ------------ | ----- | --------------------------------------------- |
| `$chunkSize` | `int` | Maximum tuples per chunk (default: API limit) |
###### Returns
`bool` — True if the operation exceeds the specified chunk size
<!-- End of evansims/openfga-php/docs/API/Models/BatchTupleOperationInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchTupleResult.md -->
### BatchTupleResult
Represents the result of a batch tuple operation. This model tracks the results of processing a batch of tuple operations, including successful chunks, failed chunks, and overall statistics. It provides methods to analyze the success rate and retrieve details about any failures that occurred during processing.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getErrors()`](#geterrors)
- [`getFailedChunks()`](#getfailedchunks)
- [`getFirstError()`](#getfirsterror)
- [`getResponses()`](#getresponses)
- [`getSuccessRate()`](#getsuccessrate)
- [`getSuccessfulChunks()`](#getsuccessfulchunks)
- [`getTotalChunks()`](#gettotalchunks)
- [`getTotalOperations()`](#gettotaloperations)
- [`isCompleteFailure()`](#iscompletefailure)
- [`isCompleteSuccess()`](#iscompletesuccess)
- [`isPartialSuccess()`](#ispartialsuccess)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
- [`throwOnFailure()`](#throwonfailure)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php)
#### Implements
- [`BatchTupleResultInterface`](https://github.com/evansims/openfga-php/blob/main/BatchTupleResultInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [BatchTupleResultInterface](https://github.com/evansims/openfga-php/blob/main/Models/BatchTupleResultInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------------ | ----------- |
| `OPENAPI_MODEL` | `BatchTupleResult` | |
#### Methods
##### getErrors
```php
public function getErrors(): array
```
Get all errors from failed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L78)
###### Returns
`array` — Errors from failed API calls
##### getFailedChunks
```php
public function getFailedChunks(): int
```
Get the number of chunks that failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L87)
###### Returns
`int` — Number of failed API requests
##### getFirstError
```php
public function getFirstError(): ?Throwable
```
Get the first error that occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L96)
###### Returns
`Throwable` | `null` — The first error, or null if no errors occurred
##### getResponses
```php
public function getResponses(): array
```
Get all successful responses from completed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L105)
###### Returns
`array` — Responses from successful API calls
##### getSuccessRate
```php
public function getSuccessRate(): float
```
Calculate the success rate as a percentage.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L123)
###### Returns
`float` — Success rate from 0.0 to 1.0
##### getSuccessfulChunks
```php
public function getSuccessfulChunks(): int
```
Get the number of chunks that completed successfully.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L114)
###### Returns
`int` — Number of successful API requests
##### getTotalChunks
```php
public function getTotalChunks(): int
```
Get the total number of chunks that were processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L136)
###### Returns
`int` — Number of API requests made
##### getTotalOperations
```php
public function getTotalOperations(): int
```
Get the total number of tuple operations that were requested.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L145)
###### Returns
`int` — Total operations across all chunks
##### isCompleteFailure
```php
public function isCompleteFailure(): bool
```
Check if all chunks failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L154)
###### Returns
`bool` — True if no chunks succeeded
##### isCompleteSuccess
```php
public function isCompleteSuccess(): bool
```
Check if all chunks completed successfully.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L163)
###### Returns
`bool` — True if no chunks failed
##### isPartialSuccess
```php
public function isPartialSuccess(): bool
```
Check if some chunks succeeded and some failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L172)
###### Returns
`bool` — True if there were both successes and failures
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L183)
###### Returns
`array<`string`, `mixed`>`
##### schema
*<small>Implements Models\BatchTupleResultInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the JSON schema for this model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L25)
###### Returns
`SchemaInterface` — The schema definition
##### throwOnFailure
```php
public function throwOnFailure(): void
```
Throw an exception if any chunks failed. If there were failures, throws the first error that occurred. This is useful for treating partial failures as complete failures when strict error handling is required.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResult.php#L201)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Models/BatchTupleResult.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/BatchTupleResultInterface.md -->
### BatchTupleResultInterface
Interface for batch tuple operation results. Defines the contract for tracking and analyzing the results of batch tuple operations, including success rates, responses, and error handling.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getErrors()`](#geterrors)
- [`getFailedChunks()`](#getfailedchunks)
- [`getFirstError()`](#getfirsterror)
- [`getResponses()`](#getresponses)
- [`getSuccessRate()`](#getsuccessrate)
- [`getSuccessfulChunks()`](#getsuccessfulchunks)
- [`getTotalChunks()`](#gettotalchunks)
- [`getTotalOperations()`](#gettotaloperations)
- [`isCompleteFailure()`](#iscompletefailure)
- [`isCompleteSuccess()`](#iscompletesuccess)
- [`isPartialSuccess()`](#ispartialsuccess)
- [`jsonSerialize()`](#jsonserialize)
- [`throwOnFailure()`](#throwonfailure)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [BatchTupleResult](https://github.com/evansims/openfga-php/blob/main/Models/BatchTupleResult.md) (implementation)
#### Methods
##### getErrors
```php
public function getErrors(): array<Throwable>
```
Get all errors from failed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L32)
###### Returns
`array<`Throwable`>` — Errors from failed API calls
##### getFailedChunks
```php
public function getFailedChunks(): int
```
Get the number of chunks that failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L39)
###### Returns
`int` — Number of failed API requests
##### getFirstError
```php
public function getFirstError(): Throwable|null
```
Get the first error that occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L46)
###### Returns
`Throwable` | `null` — The first error, or null if no errors occurred
##### getResponses
```php
public function getResponses(): array<mixed>
```
Get all successful responses from completed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L53)
###### Returns
`array<`mixed`>` — Responses from successful API calls
##### getSuccessRate
```php
public function getSuccessRate(): float
```
Calculate the success rate as a percentage.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L67)
###### Returns
`float` — Success rate from 0.0 to 1.0
##### getSuccessfulChunks
```php
public function getSuccessfulChunks(): int
```
Get the number of chunks that completed successfully.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L60)
###### Returns
`int` — Number of successful API requests
##### getTotalChunks
```php
public function getTotalChunks(): int
```
Get the total number of chunks that were processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L74)
###### Returns
`int` — Number of API requests made
##### getTotalOperations
```php
public function getTotalOperations(): int
```
Get the total number of tuple operations that were requested.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L81)
###### Returns
`int` — Total operations across all chunks
##### isCompleteFailure
```php
public function isCompleteFailure(): bool
```
Check if all chunks failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L88)
###### Returns
`bool` — True if no chunks succeeded
##### isCompleteSuccess
```php
public function isCompleteSuccess(): bool
```
Check if all chunks completed successfully.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L95)
###### Returns
`bool` — True if no chunks failed
##### isPartialSuccess
```php
public function isPartialSuccess(): bool
```
Check if some chunks succeeded and some failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L102)
###### Returns
`bool` — True if there were both successes and failures
##### jsonSerialize
```php
public function jsonSerialize()
```
##### throwOnFailure
```php
public function throwOnFailure(): void
```
Throw an exception if any chunks failed. If there were failures, throws the first error that occurred. This is useful for treating partial failures as complete failures when strict error handling is required.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/BatchTupleResultInterface.php#L113)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Models/BatchTupleResultInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Computed.md -->
### Computed
Represents a computed userset reference in authorization evaluation trees. A Computed defines a userset that is calculated based on relationships or other dynamic criteria rather than being explicitly defined. This is used in authorization evaluation trees to represent usersets that are derived through computation during the authorization check process. Use this when working with complex authorization patterns that involve computed or derived user groups.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getUserset()`](#getuserset)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Computed.php)
#### Implements
- [`ComputedInterface`](https://github.com/evansims/openfga-php/blob/main/ComputedInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [ComputedInterface](https://github.com/evansims/openfga-php/blob/main/Models/ComputedInterface.md) (interface)
- [Computeds](https://github.com/evansims/openfga-php/blob/main/Models/Collections/Computeds.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ---------- | ----------- |
| `OPENAPI_MODEL` | `Computed` | |
#### Methods
##### getUserset
```php
public function getUserset(): string
```
Get the userset reference string that defines a computed relationship. This represents a reference to another userset that should be computed dynamically based on relationships. The userset string typically follows the format "#relation" to reference a relation on the same object type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Computed.php#L53)
###### Returns
`string` — The userset reference string defining the computed relationship
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Computed.php#L62)
###### Returns
`array`
##### schema
*<small>Implements Models\ComputedInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Computed.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ComputedInterface.md -->
### ComputedInterface
Represents a computed userset in OpenFGA authorization models. Computed usersets allow you to define relationships that are calculated dynamically based on other relationships. Instead of storing direct relationships, computed usersets reference other relations that should be evaluated to determine the effective permissions. For example, if you want "viewers" of a document to include everyone who is an "editor" of that document, you could use a computed userset that references the "editor" relation. Common userset reference formats: - "#relation" - References a relation on the same object - "object#relation" - References a relation on a specific object
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getUserset()`](#getuserset)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ComputedInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Computed](https://github.com/evansims/openfga-php/blob/main/Models/Computed.md) (implementation)
#### Methods
##### getUserset
```php
public function getUserset(): string
```
Get the userset reference string that defines a computed relationship. This represents a reference to another userset that should be computed dynamically based on relationships. The userset string typically follows the format "#relation" to reference a relation on the same object type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ComputedInterface.php#L39)
###### Returns
`string` — The userset reference string defining the computed relationship
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ComputedInterface.php#L45)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/ComputedInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Condition.md -->
### Condition
Represents an ABAC (Attribute-Based Access Control) condition in your authorization model. A Condition defines a logical expression that must evaluate to true for authorization to be granted. It includes the expression code, parameter definitions, and optional metadata. Conditions enable context-aware authorization decisions based on attributes of users, resources, and environment. Use this when implementing fine-grained access control that depends on runtime attributes and contextual information.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getExpression()`](#getexpression)
- [`getMetadata()`](#getmetadata)
- [`getName()`](#getname)
- [`getParameters()`](#getparameters)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Condition.php)
#### Implements
- [`ConditionInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [ConditionInterface](https://github.com/evansims/openfga-php/blob/main/Models/ConditionInterface.md) (interface)
- [Conditions](https://github.com/evansims/openfga-php/blob/main/Models/Collections/Conditions.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ----------- | ----------- |
| `OPENAPI_MODEL` | `Condition` | |
#### Methods
##### getContext
```php
public function getContext(): ?array
```
Get the context for the condition. This provides additional runtime data that can be used by the condition's expression for dynamic evaluation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Condition.php#L66)
###### Returns
`array` | `null` — the context data, or null if not provided
##### getExpression
```php
public function getExpression(): string
```
Get the condition expression. This returns the logical expression that defines when this condition evaluates to true. The expression can reference parameters and context data to enable dynamic authorization decisions based on runtime information.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Condition.php#L75)
###### Returns
`string` — The condition expression defining the evaluation logic
##### getMetadata
```php
public function getMetadata(): ?OpenFGA\Models\ConditionMetadataInterface
```
Get metadata about the condition definition. This provides additional information about where the condition was defined and how it should be processed, which is useful for tooling and debugging.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Condition.php#L84)
###### Returns
[`ConditionMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionMetadataInterface.md) | `null` — The condition metadata, or null if not provided
##### getName
```php
public function getName(): string
```
Get the name of the condition. This is a unique identifier for the condition within the authorization model, allowing it to be referenced from type definitions and other parts of the model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Condition.php#L93)
###### Returns
`string` — The unique name identifying this condition
##### getParameters
```php
public function getParameters(): ?OpenFGA\Models\Collections\ConditionParametersInterface
```
Get the parameters available to the condition expression. These parameters define the typed inputs that can be used within the condition expression, enabling dynamic evaluation based on contextual data provided during authorization checks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Condition.php#L102)
###### Returns
[`ConditionParametersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionParametersInterface.md) | `null` — The condition parameters, or null if the condition uses no parameters
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the condition for JSON encoding. This method prepares the condition data for API requests or storage, ensuring all components are properly formatted according to the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Condition.php#L113)
###### Returns
`array<`string`, `mixed`>` — The serialized condition data
##### schema
*<small>Implements Models\ConditionInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Condition.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ConditionInterface.md -->
### ConditionInterface
Represents a condition that enables dynamic authorization in OpenFGA. Conditions allow OpenFGA to make authorization decisions based on runtime context and parameters, enabling attribute-based access control (ABAC) patterns. Rather than relying solely on static relationships, conditions evaluate expressions against dynamic data to determine if access should be granted. Conditions consist of: - **Expression**: A logical expression that evaluates to true or false - **Parameters**: Typed parameters that can be passed at evaluation time - **Name**: A unique identifier for referencing the condition - **Metadata**: Optional information about the condition definition Common condition use cases: - Time-based access (business hours, expiration dates) - Location-based restrictions (IP address, geographic region) - Resource attributes (document classification, owner validation) - User context (department, clearance level, current project) - Environmental factors (device type, authentication method) Conditions are defined in authorization models and can be referenced by relationship tuples to create dynamic permission rules. When OpenFGA evaluates a conditional relationship, it passes the current context parameters to the condition expression for evaluation. This enables sophisticated authorization patterns like "allow read access to documents during business hours" or "grant edit permissions only to users in the same department as the resource owner."
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContext()`](#getcontext)
- [`getExpression()`](#getexpression)
- [`getMetadata()`](#getmetadata)
- [`getName()`](#getname)
- [`getParameters()`](#getparameters)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Condition](https://github.com/evansims/openfga-php/blob/main/Models/Condition.md) (implementation)
#### Methods
##### getContext
```php
public function getContext(): array<string, mixed>|null
```
Get the context for the condition. This provides additional runtime data that can be used by the condition's expression for dynamic evaluation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionInterface.php#L54)
###### Returns
`array<`string`, `mixed`>` | `null` — the context data, or null if not provided
##### getExpression
```php
public function getExpression(): string
```
Get the condition expression. This returns the logical expression that defines when this condition evaluates to true. The expression can reference parameters and context data to enable dynamic authorization decisions based on runtime information.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionInterface.php#L65)
###### Returns
`string` — The condition expression defining the evaluation logic
##### getMetadata
```php
public function getMetadata(): ConditionMetadataInterface|null
```
Get metadata about the condition definition. This provides additional information about where the condition was defined and how it should be processed, which is useful for tooling and debugging.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionInterface.php#L75)
###### Returns
[`ConditionMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionMetadataInterface.md) | `null` — The condition metadata, or null if not provided
##### getName
```php
public function getName(): string
```
Get the name of the condition. This is a unique identifier for the condition within the authorization model, allowing it to be referenced from type definitions and other parts of the model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionInterface.php#L85)
###### Returns
`string` — The unique name identifying this condition
##### getParameters
```php
public function getParameters(): ConditionParametersInterface|null
```
Get the parameters available to the condition expression. These parameters define the typed inputs that can be used within the condition expression, enabling dynamic evaluation based on contextual data provided during authorization checks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionInterface.php#L96)
###### Returns
[`ConditionParametersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionParametersInterface.md) | `null` — The condition parameters, or null if the condition uses no parameters
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the condition for JSON encoding. This method prepares the condition data for API requests or storage, ensuring all components are properly formatted according to the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionInterface.php#L107)
###### Returns
`array<`string`, `mixed`>` — The serialized condition data
<!-- End of evansims/openfga-php/docs/API/Models/ConditionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ConditionMetadata.md -->
### ConditionMetadata
Contains metadata information about conditions in your authorization model. ConditionMetadata provides context about ABAC (Attribute-Based Access Control) conditions, including module organization and source information for debugging. This helps you understand where conditions are defined and how they're structured within your authorization model. Use this when working with conditional authorization rules that depend on runtime attributes and context data.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getModule()`](#getmodule)
- [`getSourceInfo()`](#getsourceinfo)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadata.php)
#### Implements
- [`ConditionMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionMetadataInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [ConditionMetadataInterface](https://github.com/evansims/openfga-php/blob/main/Models/ConditionMetadataInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------------- | ----------- |
| `OPENAPI_MODEL` | `ConditionMetadata` | |
#### Methods
##### getModule
```php
public function getModule(): string
```
Get the module name where the condition is defined. This provides organizational information about which module or namespace contains the condition definition, helping with debugging and understanding the model structure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadata.php#L56)
###### Returns
`string` — The module name containing the condition
##### getSourceInfo
```php
public function getSourceInfo(): OpenFGA\Models\SourceInfoInterface
```
Get source file information for debugging and tooling. This provides information about the source file where the condition was originally defined, which is useful for development tools, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadata.php#L65)
###### Returns
[`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/SourceInfoInterface.md) — The source file information
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadata.php#L74)
###### Returns
`array`
##### schema
*<small>Implements Models\ConditionMetadataInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/ConditionMetadata.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ConditionMetadataInterface.md -->
### ConditionMetadataInterface
Defines metadata information for conditions in OpenFGA authorization models. ConditionMetadata provides organizational and debugging information about conditions, including the module where they're defined and source file information. This helps with model analysis, debugging, and development tooling when working with complex authorization conditions. Use this interface when building tools that need to inspect or manipulate condition metadata in authorization models.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModule()`](#getmodule)
- [`getSourceInfo()`](#getsourceinfo)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadataInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [ConditionMetadata](https://github.com/evansims/openfga-php/blob/main/Models/ConditionMetadata.md) (implementation)
#### Methods
##### getModule
```php
public function getModule(): string
```
Get the module name where the condition is defined. This provides organizational information about which module or namespace contains the condition definition, helping with debugging and understanding the model structure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadataInterface.php#L31)
###### Returns
`string` — The module name containing the condition
##### getSourceInfo
```php
public function getSourceInfo(): SourceInfoInterface
```
Get source file information for debugging and tooling. This provides information about the source file where the condition was originally defined, which is useful for development tools, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadataInterface.php#L42)
###### Returns
[`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/SourceInfoInterface.md) — The source file information
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionMetadataInterface.php#L48)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/ConditionMetadataInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ConditionParameter.md -->
### ConditionParameter
Represents a parameter type definition for ABAC conditions. ConditionParameter defines the type structure for parameters used in attribute-based access control conditions. It specifies the data type (string, int, list, map, etc.) and any generic type parameters for complex types like collections. Use this when defining the expected parameter types for conditions in your authorization model.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getGenericTypes()`](#getgenerictypes)
- [`getTypeName()`](#gettypename)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameter.php)
#### Implements
- [`ConditionParameterInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionParameterInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [ConditionParameterInterface](https://github.com/evansims/openfga-php/blob/main/Models/ConditionParameterInterface.md) (interface)
- [ConditionParameters](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionParameters.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ----------------------- | ----------- |
| `OPENAPI_MODEL` | `ConditionParamTypeRef` | |
#### Methods
##### getGenericTypes
```php
public function getGenericTypes(): ?OpenFGA\Models\Collections\ConditionParametersInterface
```
Get the generic type parameters for complex types like maps and lists. This provides the nested type information for complex parameter types. For example, a map parameter would have generic types defining the key and value types, while a list parameter would define the element type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameter.php#L58)
###### Returns
[`ConditionParametersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionParametersInterface.md) | `null`
##### getTypeName
```php
public function getTypeName(): OpenFGA\Models\Enums\TypeName
```
Get the primary type name of the parameter. This returns the fundamental type of the condition parameter, such as string, int, bool, list, map, etc. This type information is used during condition evaluation to ensure type safety.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameter.php#L67)
###### Returns
[`TypeName`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/TypeName.md) — The type name enum value for this parameter
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameter.php#L76)
###### Returns
`array`
##### schema
*<small>Implements Models\ConditionParameterInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/ConditionParameter.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ConditionParameterInterface.md -->
### ConditionParameterInterface
Defines a parameter type for use in authorization conditions. ConditionParameter represents the type definition for parameters that can be passed to conditions during authorization evaluation. This includes simple types like strings and integers, as well as complex types like lists and maps with their own generic type parameters. Use this interface when defining conditions that accept typed parameters, ensuring type safety during authorization evaluation.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getGenericTypes()`](#getgenerictypes)
- [`getTypeName()`](#gettypename)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameterInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [ConditionParameter](https://github.com/evansims/openfga-php/blob/main/Models/ConditionParameter.md) (implementation)
#### Methods
##### getGenericTypes
```php
public function getGenericTypes(): ?OpenFGA\Models\Collections\ConditionParametersInterface
```
Get the generic type parameters for complex types like maps and lists. This provides the nested type information for complex parameter types. For example, a map parameter would have generic types defining the key and value types, while a list parameter would define the element type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameterInterface.php#L33)
###### Returns
[`ConditionParametersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionParametersInterface.md) | `null`
##### getTypeName
```php
public function getTypeName(): TypeName
```
Get the primary type name of the parameter. This returns the fundamental type of the condition parameter, such as string, int, bool, list, map, etc. This type information is used during condition evaluation to ensure type safety.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameterInterface.php#L44)
###### Returns
[`TypeName`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/TypeName.md) — The type name enum value for this parameter
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ConditionParameterInterface.php#L50)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/ConditionParameterInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/DifferenceV1.md -->
### DifferenceV1
Represents a set difference operation between two usersets. In authorization models, you sometimes need to grant access to one group of users while explicitly excluding another group. DifferenceV1 calculates the difference between a base userset and a subtract userset, effectively giving you "all users in base except those in subtract." For example, you might want to grant access to all employees except those in a specific department, or all document viewers except the document owner.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getBase()`](#getbase)
- [`getSubtract()`](#getsubtract)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1.php)
#### Implements
- [`DifferenceV1Interface`](https://github.com/evansims/openfga-php/blob/main/DifferenceV1Interface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [DifferenceV1Interface](https://github.com/evansims/openfga-php/blob/main/Models/DifferenceV1Interface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | --------------- | ----------- |
| `OPENAPI_MODEL` | `v1.Difference` | |
#### Methods
##### getBase
```php
public function getBase(): OpenFGA\Models\UsersetInterface
```
Get the base userset from which users will be subtracted. This represents the initial set of users or relationships from which the subtract userset will be removed to compute the final difference.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1.php#L56)
###### Returns
[`UsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetInterface.md) — The base userset for the difference operation
##### getSubtract
```php
public function getSubtract(): OpenFGA\Models\UsersetInterface
```
Get the userset of users to subtract from the base userset. This represents the set of users or relationships that should be removed from the base userset to compute the final result of the difference operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1.php#L65)
###### Returns
[`UsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetInterface.md) — The userset to subtract from the base
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1.php#L74)
###### Returns
`array`
##### schema
*<small>Implements Models\DifferenceV1Interface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/DifferenceV1.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/DifferenceV1Interface.md -->
### DifferenceV1Interface
Defines a difference operation between two usersets in authorization models. DifferenceV1 represents a set operation that computes "base minus subtract," effectively granting access to users in the base userset while explicitly denying access to users in the subtract userset. This enables complex authorization patterns like "all employees except contractors" or "organization members except suspended users." Use this interface when implementing authorization logic that requires explicit exclusion of certain users from a broader permission set.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getBase()`](#getbase)
- [`getSubtract()`](#getsubtract)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1Interface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [DifferenceV1](https://github.com/evansims/openfga-php/blob/main/Models/DifferenceV1.md) (implementation)
#### Methods
##### getBase
```php
public function getBase(): UsersetInterface
```
Get the base userset from which users will be subtracted. This represents the initial set of users or relationships from which the subtract userset will be removed to compute the final difference.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1Interface.php#L31)
###### Returns
[`UsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetInterface.md) — The base userset for the difference operation
##### getSubtract
```php
public function getSubtract(): UsersetInterface
```
Get the userset of users to subtract from the base userset. This represents the set of users or relationships that should be removed from the base userset to compute the final result of the difference operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1Interface.php#L41)
###### Returns
[`UsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetInterface.md) — The userset to subtract from the base
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/DifferenceV1Interface.php#L61)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/DifferenceV1Interface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Leaf.md -->
### Leaf
Represents a leaf node in authorization evaluation trees containing specific users. A Leaf is a terminal node in the authorization evaluation tree that contains a concrete set of users rather than further computation rules. It represents the final resolved users at the end of an authorization evaluation path. Use this when you need to represent the actual users that result from authorization rule evaluation, as opposed to computed or derived usersets.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getComputed()`](#getcomputed)
- [`getTupleToUserset()`](#gettupletouserset)
- [`getUsers()`](#getusers)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Leaf.php)
#### Implements
- [`LeafInterface`](https://github.com/evansims/openfga-php/blob/main/LeafInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [LeafInterface](https://github.com/evansims/openfga-php/blob/main/Models/LeafInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------ | ----------- |
| `OPENAPI_MODEL` | `Leaf` | |
#### Methods
##### getComputed
```php
public function getComputed(): ?OpenFGA\Models\ComputedInterface
```
Get the computed userset specification for this leaf. When present, this defines a computed relationship that resolves to other usersets dynamically. This allows for indirect relationships where users are determined by following other relations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Leaf.php#L71)
###### Returns
[`ComputedInterface`](https://github.com/evansims/openfga-php/blob/main/ComputedInterface.md) | `null` — The computed userset specification, or null if not used
##### getTupleToUserset
```php
public function getTupleToUserset(): ?OpenFGA\Models\UsersetTreeTupleToUsersetInterface
```
Get the tuple-to-userset operation for this leaf. When present, this defines how to compute users by examining tuples and resolving them to usersets. This enables complex relationship patterns where users are derived from tuple relationships.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Leaf.php#L80)
###### Returns
[`UsersetTreeTupleToUsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetTreeTupleToUsersetInterface.md) | `null` — The tuple-to-userset operation, or null if not used
##### getUsers
```php
public function getUsers(): ?OpenFGA\Models\Collections\UsersListInterface
```
Get the direct list of users for this leaf node. When present, this provides an explicit list of users who have access through this leaf. This is used for direct user assignments rather than computed or derived access patterns.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Leaf.php#L89)
###### Returns
[`UsersListInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersListInterface.md) | `null` — The list of users with direct access, or null if not used
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Leaf.php#L98)
###### Returns
`array`
##### schema
*<small>Implements Models\LeafInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Leaf.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/LeafInterface.md -->
### LeafInterface
Represents a leaf node in OpenFGA's userset tree structure. Leaf nodes are terminal nodes in the authorization evaluation tree that define the actual users or user resolution methods. They represent the final step in determining who has access to a particular resource through a specific relation. A leaf can specify users through one of three mechanisms: 1. **Direct users**: An explicit list of user identifiers 2. **Computed userset**: A reference to another userset to be evaluated 3. **Tuple-to-userset**: A complex resolution that follows tuple relationships Only one of these mechanisms should be active in any given leaf node, as they represent different strategies for determining the final user set.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getComputed()`](#getcomputed)
- [`getTupleToUserset()`](#gettupletouserset)
- [`getUsers()`](#getusers)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/LeafInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Leaf](https://github.com/evansims/openfga-php/blob/main/Models/Leaf.md) (implementation)
#### Methods
##### getComputed
```php
public function getComputed(): ComputedInterface|null
```
Get the computed userset specification for this leaf. When present, this defines a computed relationship that resolves to other usersets dynamically. This allows for indirect relationships where users are determined by following other relations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/LeafInterface.php#L41)
###### Returns
[`ComputedInterface`](https://github.com/evansims/openfga-php/blob/main/ComputedInterface.md) | `null` — The computed userset specification, or null if not used
##### getTupleToUserset
```php
public function getTupleToUserset(): UsersetTreeTupleToUsersetInterface|null
```
Get the tuple-to-userset operation for this leaf. When present, this defines how to compute users by examining tuples and resolving them to usersets. This enables complex relationship patterns where users are derived from tuple relationships.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/LeafInterface.php#L52)
###### Returns
[`UsersetTreeTupleToUsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetTreeTupleToUsersetInterface.md) | `null` — The tuple-to-userset operation, or null if not used
##### getUsers
```php
public function getUsers(): UsersListInterface|null
```
Get the direct list of users for this leaf node. When present, this provides an explicit list of users who have access through this leaf. This is used for direct user assignments rather than computed or derived access patterns.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/LeafInterface.php#L63)
###### Returns
[`UsersListInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersListInterface.md) | `null` — The list of users with direct access, or null if not used
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/LeafInterface.php#L69)
###### Returns
`array<`string`, `mixed`>`
<!-- End of evansims/openfga-php/docs/API/Models/LeafInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Metadata.md -->
### Metadata
Contains metadata information about type definitions in your authorization model. Metadata provides additional context about how your authorization types behave, including module information, relation constraints, and source details. This information helps with model validation, debugging, and understanding the structure of your authorization system. Use this when you need insights into the properties and constraints of your authorization model's type definitions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getModule()`](#getmodule)
- [`getRelations()`](#getrelations)
- [`getSourceInfo()`](#getsourceinfo)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Metadata.php)
#### Implements
- [`MetadataInterface`](https://github.com/evansims/openfga-php/blob/main/MetadataInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [MetadataInterface](https://github.com/evansims/openfga-php/blob/main/Models/MetadataInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ---------- | ----------- |
| `OPENAPI_MODEL` | `Metadata` | |
#### Methods
##### getModule
```php
public function getModule(): ?string
```
Get the module name for this metadata. Modules provide a way to organize and namespace authorization model components, similar to packages in programming languages. This helps with model organization and prevents naming conflicts in large authorization systems.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Metadata.php#L62)
###### Returns
`string` | `null` — The module name, or null if not specified
##### getRelations
```php
public function getRelations(): ?OpenFGA\Models\Collections\RelationMetadataCollection
```
Get the collection of relation metadata. Relation metadata provides additional configuration and context for specific relations within a type definition. This can include documentation, constraints, or other relation-specific settings that enhance the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Metadata.php#L71)
###### Returns
[`RelationMetadataCollection`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/RelationMetadataCollection.md) | `null` — The relation metadata collection, or null if not specified
##### getSourceInfo
```php
public function getSourceInfo(): ?OpenFGA\Models\SourceInfoInterface
```
Get the source code information for this metadata. Source information provides debugging and development context by tracking where authorization model elements were defined. This is particularly useful for development tools and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Metadata.php#L80)
###### Returns
[`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/SourceInfoInterface.md) | `null` — The source information, or null if not available
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Metadata.php#L89)
###### Returns
`array`
##### schema
*<small>Implements Models\MetadataInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Metadata.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/MetadataInterface.md -->
### MetadataInterface
Represents metadata associated with OpenFGA authorization model components. Metadata provides additional context and configuration information for authorization model elements. This includes module organization, relation-specific metadata, and source code information for debugging and development purposes. Metadata helps with model organization, documentation, and tooling support for complex authorization models.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModule()`](#getmodule)
- [`getRelations()`](#getrelations)
- [`getSourceInfo()`](#getsourceinfo)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/MetadataInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Metadata](https://github.com/evansims/openfga-php/blob/main/Models/Metadata.md) (implementation)
#### Methods
##### getModule
```php
public function getModule(): string|null
```
Get the module name for this metadata. Modules provide a way to organize and namespace authorization model components, similar to packages in programming languages. This helps with model organization and prevents naming conflicts in large authorization systems.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/MetadataInterface.php#L33)
###### Returns
`string` | `null` — The module name, or null if not specified
##### getRelations
```php
public function getRelations(): RelationMetadataCollection|null
```
Get the collection of relation metadata. Relation metadata provides additional configuration and context for specific relations within a type definition. This can include documentation, constraints, or other relation-specific settings that enhance the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/MetadataInterface.php#L45)
###### Returns
[`RelationMetadataCollection`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/RelationMetadataCollection.md) | `null` — The relation metadata collection, or null if not specified
##### getSourceInfo
```php
public function getSourceInfo(): SourceInfoInterface|null
```
Get the source code information for this metadata. Source information provides debugging and development context by tracking where authorization model elements were defined. This is particularly useful for development tools and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/MetadataInterface.php#L56)
###### Returns
[`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/SourceInfoInterface.md) | `null` — The source information, or null if not available
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/MetadataInterface.php#L62)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/MetadataInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ModelInterface.md -->
### ModelInterface
Base interface for all OpenFGA model objects. This interface establishes the foundation for all domain models in the OpenFGA SDK, ensuring consistent behavior for serialization and schema validation across the entire model hierarchy. All OpenFGA models implement this interface to provide uniform JSON serialization capabilities and schema-based validation. Models in the OpenFGA ecosystem represent various authorization concepts: - Authorization models that define permission structures - Relationship tuples that establish actual relationships - Stores that contain authorization data - Users, objects, and conditions used in authorization decisions The schema system enables robust type checking, validation, and transformation of data throughout the SDK, ensuring data integrity and API compatibility.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php)
#### Implements
- `JsonSerializable`
#### Methods
##### jsonSerialize
```php
public function jsonSerialize()
```
<!-- End of evansims/openfga-php/docs/API/Models/ModelInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Node.md -->
### Node
Represents a node in the authorization evaluation tree structure. When OpenFGA evaluates complex authorization rules, it builds a tree of nodes representing different evaluation paths. Each node can contain unions, intersections, differences, or leaf computations that contribute to the final authorization decision. This is the fundamental building block for representing how authorization decisions are computed and provides insight into the evaluation process.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getDifference()`](#getdifference)
- [`getIntersection()`](#getintersection)
- [`getLeaf()`](#getleaf)
- [`getName()`](#getname)
- [`getUnion()`](#getunion)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Node.php)
#### Implements
- [`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [NodeInterface](https://github.com/evansims/openfga-php/blob/main/Models/NodeInterface.md) (interface)
- [Nodes](https://github.com/evansims/openfga-php/blob/main/Models/Collections/Nodes.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ------ | ----------- |
| `OPENAPI_MODEL` | `Node` | |
#### Methods
##### getDifference
```php
public function getDifference(): ?OpenFGA\Models\UsersetTreeDifferenceInterface
```
Get the difference operation for this node. The difference operation represents a set subtraction where users from one set are excluded from another set.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Node.php#L64)
###### Returns
[`UsersetTreeDifferenceInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetTreeDifferenceInterface.md) | `null`
##### getIntersection
```php
public function getIntersection(): ?OpenFGA\Models\NodeInterface|OpenFGA\Models\NodeUnionInterface|null
```
Get the intersection operation for this node. The intersection operation represents the common elements between multiple usersets in the authorization tree.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Node.php#L73)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) | `null` | [`NodeUnionInterface`](https://github.com/evansims/openfga-php/blob/main/NodeUnionInterface.md) | `null` — The intersection node or null if not applicable
##### getLeaf
```php
public function getLeaf(): ?OpenFGA\Models\LeafInterface
```
Get the leaf node if this is a terminal node. Leaf nodes represent the actual users, computed usersets, or tuple-to-userset relationships at the end of the evaluation tree.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Node.php#L82)
###### Returns
[`LeafInterface`](https://github.com/evansims/openfga-php/blob/main/LeafInterface.md) | `null`
##### getName
```php
public function getName(): string
```
Get the name identifier for this node. The name is used to identify the node within the authorization model and corresponds to relation names or other identifiers.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Node.php#L91)
###### Returns
`string` — The node name
##### getUnion
```php
public function getUnion(): ?OpenFGA\Models\NodeInterface|OpenFGA\Models\NodeUnionInterface|null
```
Get the union operation for this node. The union operation represents the combination of multiple usersets where users from any of the sets are included in the result.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Node.php#L100)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) | `null` | [`NodeUnionInterface`](https://github.com/evansims/openfga-php/blob/main/NodeUnionInterface.md) | `null` — The union node or null if not applicable
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the node to its JSON representation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Node.php#L109)
###### Returns
`array` — The serialized node data
##### schema
*<small>Implements Models\NodeInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Node.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/NodeInterface.md -->
### NodeInterface
Represents a node in a userset tree structure. Nodes are fundamental building blocks in OpenFGA's authorization model that represent different types of relationships and operations within the access control evaluation tree.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getDifference()`](#getdifference)
- [`getIntersection()`](#getintersection)
- [`getLeaf()`](#getleaf)
- [`getName()`](#getname)
- [`getUnion()`](#getunion)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Node](https://github.com/evansims/openfga-php/blob/main/Models/Node.md) (implementation)
#### Methods
##### getDifference
```php
public function getDifference(): ?OpenFGA\Models\UsersetTreeDifferenceInterface
```
Get the difference operation for this node. The difference operation represents a set subtraction where users from one set are excluded from another set.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeInterface.php#L26)
###### Returns
[`UsersetTreeDifferenceInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetTreeDifferenceInterface.md) | `null`
##### getIntersection
```php
public function getIntersection(): NodeUnionInterface|self|null
```
Get the intersection operation for this node. The intersection operation represents the common elements between multiple usersets in the authorization tree.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeInterface.php#L36)
###### Returns
[`NodeUnionInterface`](https://github.com/evansims/openfga-php/blob/main/NodeUnionInterface.md) | `self` | `null` — The intersection node or null if not applicable
##### getLeaf
```php
public function getLeaf(): ?OpenFGA\Models\LeafInterface
```
Get the leaf node if this is a terminal node. Leaf nodes represent the actual users, computed usersets, or tuple-to-userset relationships at the end of the evaluation tree.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeInterface.php#L46)
###### Returns
[`LeafInterface`](https://github.com/evansims/openfga-php/blob/main/LeafInterface.md) | `null`
##### getName
```php
public function getName(): string
```
Get the name identifier for this node. The name is used to identify the node within the authorization model and corresponds to relation names or other identifiers.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeInterface.php#L56)
###### Returns
`string` — The node name
##### getUnion
```php
public function getUnion(): NodeUnionInterface|self|null
```
Get the union operation for this node. The union operation represents the combination of multiple usersets where users from any of the sets are included in the result.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeInterface.php#L66)
###### Returns
[`NodeUnionInterface`](https://github.com/evansims/openfga-php/blob/main/NodeUnionInterface.md) | `self` | `null` — The union node or null if not applicable
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the node to its JSON representation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeInterface.php#L74)
###### Returns
`array<`string`, `mixed`>` — The serialized node data
<!-- End of evansims/openfga-php/docs/API/Models/NodeInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/NodeUnion.md -->
### NodeUnion
Represents a union of multiple nodes in an authorization model tree. When OpenFGA evaluates complex authorization rules, it often needs to combine results from multiple authorization paths. A NodeUnion contains a collection of nodes that should be evaluated together, typically representing an OR relationship where access is granted if any of the contained nodes grants access. This is commonly used in authorization model structures where a user can have access through multiple different permission paths.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getNodes()`](#getnodes)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeUnion.php)
#### Implements
- [`NodeUnionInterface`](https://github.com/evansims/openfga-php/blob/main/NodeUnionInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [NodeUnionInterface](https://github.com/evansims/openfga-php/blob/main/Models/NodeUnionInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ----------- | ----------- |
| `OPENAPI_MODEL` | `NodeUnion` | |
#### Methods
##### getNodes
```php
public function getNodes(): array<int, NodeInterface>
```
Get the collection of nodes that participate in this union. Returns all the nodes that are combined in this union operation. The union result includes users from any of these nodes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeUnion.php#L55)
###### Returns
`array<`int`, [`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md)>` — The array of nodes in the union
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the node union to its JSON representation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeUnion.php#L64)
###### Returns
`array`
##### schema
*<small>Implements Models\NodeUnionInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/NodeUnion.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/NodeUnionInterface.md -->
### NodeUnionInterface
Represents a union operation between multiple nodes in a userset tree. A node union combines multiple authorization nodes where users from any of the constituent nodes are included in the result set. This implements the logical OR operation in authorization evaluation.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getNodes()`](#getnodes)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeUnionInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [NodeUnion](https://github.com/evansims/openfga-php/blob/main/Models/NodeUnion.md) (implementation)
#### Methods
##### getNodes
```php
public function getNodes(): array<int, NodeInterface>
```
Get the collection of nodes that participate in this union. Returns all the nodes that are combined in this union operation. The union result includes users from any of these nodes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeUnionInterface.php#L26)
###### Returns
`array<`int`, [`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md)>` — The array of nodes in the union
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the node union to its JSON representation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/NodeUnionInterface.php#L34)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/NodeUnionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ObjectRelation.md -->
### ObjectRelation
Represents a reference to a specific relation on an object. In authorization models, you often need to reference relationships between objects. An ObjectRelation identifies both the target object and the specific relation you're interested in, like "the owner of document:budget" or "editors of folder:reports." This is commonly used in authorization rules where permissions depend on relationships with other objects in your system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelation.php)
#### Implements
- [`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/ObjectRelationInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [ObjectRelationInterface](https://github.com/evansims/openfga-php/blob/main/Models/ObjectRelationInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ---------------- | ----------- |
| `OPENAPI_MODEL` | `ObjectRelation` | |
#### Methods
##### getObject
```php
public function getObject(): ?string
```
Get the object identifier in an object-relation pair. The object represents the resource or entity being referenced, typically formatted as "type:id" where type describes the kind of resource.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelation.php#L62)
###### Returns
`string` | `null`
##### getRelation
```php
public function getRelation(): string
```
Get the relation name that defines the type of relationship to the object. The relation describes what kind of permission or relationship exists. Common examples include "owner," "viewer," "editor," "member."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelation.php#L71)
###### Returns
`string` — The non-empty relation name
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelation.php#L80)
###### Returns
`array`
##### schema
*<small>Implements Models\ObjectRelationInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/ObjectRelation.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/ObjectRelationInterface.md -->
### ObjectRelationInterface
Represents an object-relation pair in OpenFGA authorization models. Object-relation pairs are fundamental components that specify a relationship between a specific object and a relation type. They are commonly used in: - Tuple definitions to specify what relationship exists - Userset references to point to related objects - Permission lookups to identify target resources The pair consists of: - Object: The target resource (for example, "document:readme," "folder:private") - Relation: The type of relationship (for example, "viewer," "editor," "owner") Examples: - {object: "document:readme," relation: "viewer"} - {object: "folder:private," relation: "owner"} - {relation: "member"} (object can be omitted in some contexts)
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelationInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [ObjectRelation](https://github.com/evansims/openfga-php/blob/main/Models/ObjectRelation.md) (implementation)
#### Methods
##### getObject
```php
public function getObject(): ?string
```
Get the object identifier in an object-relation pair. The object represents the resource or entity being referenced, typically formatted as "type:id" where type describes the kind of resource.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelationInterface.php#L40)
###### Returns
`string` | `null`
##### getRelation
```php
public function getRelation(): string
```
Get the relation name that defines the type of relationship to the object. The relation describes what kind of permission or relationship exists. Common examples include "owner," "viewer," "editor," "member."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelationInterface.php#L50)
###### Returns
`string` — The non-empty relation name
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ObjectRelationInterface.php#L56)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/ObjectRelationInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/README.md -->
## Models
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Models
Domain models representing OpenFGA entities like stores, tuples, and authorization models.
**Total Components:** 73
### Subdirectories
| Directory | Description |
|-----------|-------------|
| [`Collections`](https://github.com/evansims/openfga-php/blob/main/./Collections/README.md) | Type-safe collections for managing groups of domain objects. |
| [`Enums`](https://github.com/evansims/openfga-php/blob/main/./Enums/README.md) | Enumeration types for consistent value constraints across the SDK. |
### Interfaces
| Name | Description |
|------|-------------|
| [`AssertionInterface`](https://github.com/evansims/openfga-php/blob/main/./AssertionInterface.md) | Represents an assertion used to test authorization model correctness. Assertions are test cases t... |
| [`AssertionTupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/./AssertionTupleKeyInterface.md) | Defines the contract for assertion tuple keys used in authorization model testing. An assertion t... |
| [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/./AuthorizationModelInterface.md) | Represents an OpenFGA authorization model that defines permission structures. Authorization model... |
| [`BatchCheckItemInterface`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckItemInterface.md) | Represents a single item in a batch check request. Each batch check item contains a tuple key to ... |
| [`BatchCheckSingleResultInterface`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckSingleResultInterface.md) | Represents the result of a single check within a batch check response. Each result contains wheth... |
| [`BatchTupleOperationInterface`](https://github.com/evansims/openfga-php/blob/main/./BatchTupleOperationInterface.md) | Interface for batch tuple operations. Defines the contract for organizing tuple writes and delete... |
| [`BatchTupleResultInterface`](https://github.com/evansims/openfga-php/blob/main/./BatchTupleResultInterface.md) | Interface for batch tuple operation results. Defines the contract for tracking and analyzing the ... |
| [`ComputedInterface`](https://github.com/evansims/openfga-php/blob/main/./ComputedInterface.md) | Represents a computed userset in OpenFGA authorization models. Computed usersets allow you to def... |
| [`ConditionInterface`](https://github.com/evansims/openfga-php/blob/main/./ConditionInterface.md) | Represents a condition that enables dynamic authorization in OpenFGA. Conditions allow OpenFGA to... |
| [`ConditionMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/./ConditionMetadataInterface.md) | Defines metadata information for conditions in OpenFGA authorization models. ConditionMetadata pr... |
| [`ConditionParameterInterface`](https://github.com/evansims/openfga-php/blob/main/./ConditionParameterInterface.md) | Defines a parameter type for use in authorization conditions. ConditionParameter represents the t... |
| [`DifferenceV1Interface`](https://github.com/evansims/openfga-php/blob/main/./DifferenceV1Interface.md) | Defines a difference operation between two usersets in authorization models. DifferenceV1 represe... |
| [`LeafInterface`](https://github.com/evansims/openfga-php/blob/main/./LeafInterface.md) | Represents a leaf node in OpenFGA's userset tree structure. Leaf nodes are terminal nodes in the ... |
| [`MetadataInterface`](https://github.com/evansims/openfga-php/blob/main/./MetadataInterface.md) | Represents metadata associated with OpenFGA authorization model components. Metadata provides add... |
| [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/./ModelInterface.md) | Base interface for all OpenFGA model objects. This interface establishes the foundation for all d... |
| [`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/./NodeInterface.md) | Represents a node in a userset tree structure. Nodes are fundamental building blocks in OpenFGA's... |
| [`NodeUnionInterface`](https://github.com/evansims/openfga-php/blob/main/./NodeUnionInterface.md) | Represents a union operation between multiple nodes in a userset tree. A node union combines mult... |
| [`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/./ObjectRelationInterface.md) | Represents an object-relation pair in OpenFGA authorization models. Object-relation pairs are fun... |
| [`RelationMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/./RelationMetadataInterface.md) | Represents metadata associated with a relation in OpenFGA authorization models. Relation metadata... |
| [`RelationReferenceInterface`](https://github.com/evansims/openfga-php/blob/main/./RelationReferenceInterface.md) | Defines the contract for relation references with optional conditions. A relation reference speci... |
| [`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/./SourceInfoInterface.md) | Represents source file information for OpenFGA model elements. Source information provides debugg... |
| [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/./StoreInterface.md) | Represents an OpenFGA store that contains authorization models and relationship tuples. A store i... |
| [`TupleChangeInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleChangeInterface.md) | Represents a change event for a relationship tuple in OpenFGA. Tuple changes capture the history ... |
| [`TupleInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleInterface.md) | Represents a relationship tuple in the OpenFGA authorization system. Tuples are the fundamental b... |
| [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleKeyInterface.md) | Represents a tuple key that defines the components of a relationship in OpenFGA. Tuple keys are t... |
| [`TupleToUsersetV1Interface`](https://github.com/evansims/openfga-php/blob/main/./TupleToUsersetV1Interface.md) | Defines a tuple-to-userset operation in authorization models. TupleToUsersetV1 represents an auth... |
| [`TypeDefinitionInterface`](https://github.com/evansims/openfga-php/blob/main/./TypeDefinitionInterface.md) | Represents a type definition in an OpenFGA authorization model. Type definitions are the building... |
| [`TypedWildcardInterface`](https://github.com/evansims/openfga-php/blob/main/./TypedWildcardInterface.md) | Defines the contract for typed wildcard specifications. A typed wildcard represents "all users of... |
| [`UserInterface`](https://github.com/evansims/openfga-php/blob/main/./UserInterface.md) | Represents a user in an OpenFGA authorization model. In OpenFGA, users are flexible entities that... |
| [`UserObjectInterface`](https://github.com/evansims/openfga-php/blob/main/./UserObjectInterface.md) | Represents a user object in OpenFGA authorization model. User objects are typed entities that can... |
| [`UserTypeFilterInterface`](https://github.com/evansims/openfga-php/blob/main/./UserTypeFilterInterface.md) | Represents a filter for limiting users by their relationships to specific object types. User type... |
| [`UsersListUserInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersListUserInterface.md) | Represents a user in a list context for authorization operations. UsersListUser provides a simple... |
| [`UsersetInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersetInterface.md) | Defines the contract for userset specifications in authorization models. A userset represents a c... |
| [`UsersetTreeDifferenceInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersetTreeDifferenceInterface.md) | Defines a difference operation node in authorization evaluation trees. UsersetTreeDifference repr... |
| [`UsersetTreeInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersetTreeInterface.md) | Defines a tree structure for representing complex userset operations. UsersetTree provides a hier... |
| [`UsersetTreeTupleToUsersetInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersetTreeTupleToUsersetInterface.md) | Defines a tuple-to-userset operation node in authorization evaluation trees. UsersetTreeTupleToUs... |
| [`UsersetUserInterface`](https://github.com/evansims/openfga-php/blob/main/./UsersetUserInterface.md) | Defines the contract for userset user specifications. A userset user represents a reference to us... |
### Classes
| Name | Description |
|------|-------------|
| [`Assertion`](https://github.com/evansims/openfga-php/blob/main/./Assertion.md) | Tests whether your authorization model behaves correctly for specific scenarios. Assertions are t... |
| [`AssertionTupleKey`](https://github.com/evansims/openfga-php/blob/main/./AssertionTupleKey.md) | Represents a tuple key used for testing authorization model assertions. An AssertionTupleKey defi... |
| [`AuthorizationModel`](https://github.com/evansims/openfga-php/blob/main/./AuthorizationModel.md) | Defines the authorization rules and relationships for your application. An AuthorizationModel is ... |
| [`BatchCheckItem`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckItem.md) | Represents a single item in a batch check request. Each batch check item contains a tuple key to ... |
| [`BatchCheckSingleResult`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckSingleResult.md) | Represents the result of a single check within a batch check response. Each result contains wheth... |
| [`BatchTupleOperation`](https://github.com/evansims/openfga-php/blob/main/./BatchTupleOperation.md) | Represents a batch tuple operation containing both writes and deletes. This model organizes tuple... |
| [`BatchTupleResult`](https://github.com/evansims/openfga-php/blob/main/./BatchTupleResult.md) | Represents the result of a batch tuple operation. This model tracks the results of processing a b... |
| [`Computed`](https://github.com/evansims/openfga-php/blob/main/./Computed.md) | Represents a computed userset reference in authorization evaluation trees. A Computed defines a u... |
| [`Condition`](https://github.com/evansims/openfga-php/blob/main/./Condition.md) | Represents an ABAC (Attribute-Based Access Control) condition in your authorization model. A Cond... |
| [`ConditionMetadata`](https://github.com/evansims/openfga-php/blob/main/./ConditionMetadata.md) | Contains metadata information about conditions in your authorization model. ConditionMetadata pro... |
| [`ConditionParameter`](https://github.com/evansims/openfga-php/blob/main/./ConditionParameter.md) | Represents a parameter type definition for ABAC conditions. ConditionParameter defines the type s... |
| [`DifferenceV1`](https://github.com/evansims/openfga-php/blob/main/./DifferenceV1.md) | Represents a set difference operation between two usersets. In authorization models, you sometime... |
| [`Leaf`](https://github.com/evansims/openfga-php/blob/main/./Leaf.md) | Represents a leaf node in authorization evaluation trees containing specific users. A Leaf is a t... |
| [`Metadata`](https://github.com/evansims/openfga-php/blob/main/./Metadata.md) | Contains metadata information about type definitions in your authorization model. Metadata provid... |
| [`Node`](https://github.com/evansims/openfga-php/blob/main/./Node.md) | Represents a node in the authorization evaluation tree structure. When OpenFGA evaluates complex ... |
| [`NodeUnion`](https://github.com/evansims/openfga-php/blob/main/./NodeUnion.md) | Represents a union of multiple nodes in an authorization model tree. When OpenFGA evaluates compl... |
| [`ObjectRelation`](https://github.com/evansims/openfga-php/blob/main/./ObjectRelation.md) | Represents a reference to a specific relation on an object. In authorization models, you often ne... |
| [`RelationMetadata`](https://github.com/evansims/openfga-php/blob/main/./RelationMetadata.md) | Contains metadata information about a relation in your authorization model. RelationMetadata prov... |
| [`RelationReference`](https://github.com/evansims/openfga-php/blob/main/./RelationReference.md) | Represents a reference to a specific relation with optional conditions. A RelationReference ident... |
| [`SourceInfo`](https://github.com/evansims/openfga-php/blob/main/./SourceInfo.md) | Represents source file information for debugging and development tools. SourceInfo provides metad... |
| [`Store`](https://github.com/evansims/openfga-php/blob/main/./Store.md) | Represents an OpenFGA authorization store that contains your permission data. A Store is a contai... |
| [`Tuple`](https://github.com/evansims/openfga-php/blob/main/./Tuple.md) | Represents a stored relationship tuple in your authorization system. A Tuple is a relationship re... |
| [`TupleChange`](https://github.com/evansims/openfga-php/blob/main/./TupleChange.md) | Represents a change to a relationship tuple in your authorization store. When you modify relation... |
| [`TupleKey`](https://github.com/evansims/openfga-php/blob/main/./TupleKey.md) | Represents a relationship tuple key defining a connection between user, relation, and object. A T... |
| [`TupleToUsersetV1`](https://github.com/evansims/openfga-php/blob/main/./TupleToUsersetV1.md) | Represents a tuple-to-userset relationship that derives permissions from related objects. This en... |
| [`TypeDefinition`](https://github.com/evansims/openfga-php/blob/main/./TypeDefinition.md) | Represents a type definition in your authorization model. A TypeDefinition defines an object type... |
| [`TypedWildcard`](https://github.com/evansims/openfga-php/blob/main/./TypedWildcard.md) | Represents a wildcard that matches all users of a specific type. In authorization models, you som... |
| [`User`](https://github.com/evansims/openfga-php/blob/main/./User.md) | Represents a user or user specification in authorization contexts. A User can represent different... |
| [`UserObject`](https://github.com/evansims/openfga-php/blob/main/./UserObject.md) | Represents a specific user object with type and identifier. A UserObject provides a structured wa... |
| [`UserTypeFilter`](https://github.com/evansims/openfga-php/blob/main/./UserTypeFilter.md) | Represents a filter for limiting users by type and optional relation. UserTypeFilter allows you t... |
| [`UsersListUser`](https://github.com/evansims/openfga-php/blob/main/./UsersListUser.md) | Represents a user entry in a users list response. UsersListUser provides a simple wrapper around ... |
| [`Userset`](https://github.com/evansims/openfga-php/blob/main/./Userset.md) | Represents a userset specification for computing groups of users. A Userset defines how to comput... |
| [`UsersetTree`](https://github.com/evansims/openfga-php/blob/main/./UsersetTree.md) | Represents the evaluation tree for determining user access. When OpenFGA evaluates whether a user... |
| [`UsersetTreeDifference`](https://github.com/evansims/openfga-php/blob/main/./UsersetTreeDifference.md) | Represents a difference operation node in authorization evaluation trees. UsersetTreeDifference c... |
| [`UsersetTreeTupleToUserset`](https://github.com/evansims/openfga-php/blob/main/./UsersetTreeTupleToUserset.md) | Represents a tuple-to-userset operation node in authorization evaluation trees. UsersetTreeTupleT... |
| [`UsersetUser`](https://github.com/evansims/openfga-php/blob/main/./UsersetUser.md) | Represents a user reference through a userset relationship. UsersetUser defines a user specificat... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Models/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/RelationMetadata.md -->
### RelationMetadata
Contains metadata information about a relation in your authorization model. RelationMetadata provides additional context about how a relation behaves, including which user types can be directly assigned to it and source information for debugging. This helps with model validation and provides insights into your authorization structure. Use this when you need to understand the constraints and properties of specific relations in your authorization model.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getDirectlyRelatedUserTypes()`](#getdirectlyrelatedusertypes)
- [`getModule()`](#getmodule)
- [`getSourceInfo()`](#getsourceinfo)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadata.php)
#### Implements
- [`RelationMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/RelationMetadataInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [RelationMetadataInterface](https://github.com/evansims/openfga-php/blob/main/Models/RelationMetadataInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------------ | ----------- |
| `OPENAPI_MODEL` | `RelationMetadata` | |
#### Methods
##### getDirectlyRelatedUserTypes
```php
public function getDirectlyRelatedUserTypes(): ?OpenFGA\Models\Collections\RelationReferencesInterface
```
Get the user types that can be directly related through this relation. This defines which types of users can have this relation to objects, providing type safety and helping with authorization model validation. For example, a "member" relation might allow "user" and "group" types.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadata.php#L60)
###### Returns
[`RelationReferencesInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/RelationReferencesInterface.md) | `null` — The directly related user types, or null if not specified
##### getModule
```php
public function getModule(): ?string
```
Get the optional module name for organization. This provides organizational information about which module or namespace contains the relation definition, helping with model organization and debugging.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadata.php#L69)
###### Returns
`string` | `null` — The module name, or null if not specified
##### getSourceInfo
```php
public function getSourceInfo(): ?OpenFGA\Models\SourceInfoInterface
```
Get optional source file information for debugging and tooling. This provides information about the source file where the relation was originally defined, which is useful for development tools, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadata.php#L78)
###### Returns
[`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/SourceInfoInterface.md) | `null` — The source file information, or null if not available
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadata.php#L87)
###### Returns
`array`
##### schema
*<small>Implements Models\RelationMetadataInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/RelationMetadata.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/RelationMetadataInterface.md -->
### RelationMetadataInterface
Represents metadata associated with a relation in OpenFGA authorization models. Relation metadata provides additional context and constraints for relations defined in type definitions. This metadata helps with: - Type safety by defining which user types can be directly related - Development tooling by providing source file information - Model organization through module names - Validation and error reporting The metadata is particularly important for: - Ensuring that only appropriate user types can be assigned to relations - Providing helpful error messages when model validation fails - Supporting development tools that work with authorization models - Organizing complex models across multiple modules or files
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getDirectlyRelatedUserTypes()`](#getdirectlyrelatedusertypes)
- [`getModule()`](#getmodule)
- [`getSourceInfo()`](#getsourceinfo)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadataInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [RelationMetadata](https://github.com/evansims/openfga-php/blob/main/Models/RelationMetadata.md) (implementation)
#### Methods
##### getDirectlyRelatedUserTypes
```php
public function getDirectlyRelatedUserTypes(): RelationReferencesInterface|null
```
Get the user types that can be directly related through this relation. This defines which types of users can have this relation to objects, providing type safety and helping with authorization model validation. For example, a "member" relation might allow "user" and "group" types.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadataInterface.php#L41)
###### Returns
[`RelationReferencesInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/RelationReferencesInterface.md) | `null` — The directly related user types, or null if not specified
##### getModule
```php
public function getModule(): string|null
```
Get the optional module name for organization. This provides organizational information about which module or namespace contains the relation definition, helping with model organization and debugging.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadataInterface.php#L52)
###### Returns
`string` | `null` — The module name, or null if not specified
##### getSourceInfo
```php
public function getSourceInfo(): SourceInfoInterface|null
```
Get optional source file information for debugging and tooling. This provides information about the source file where the relation was originally defined, which is useful for development tools, debugging, and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadataInterface.php#L63)
###### Returns
[`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/SourceInfoInterface.md) | `null` — The source file information, or null if not available
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationMetadataInterface.php#L69)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/RelationMetadataInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/RelationReference.md -->
### RelationReference
Represents a reference to a specific relation with optional conditions. A RelationReference identifies a relation within your authorization model, optionally with an associated condition that must be satisfied. This enables conditional relationships where the relation is only valid when certain runtime conditions are met. Use this when defining relation constraints or implementing attribute-based access control patterns in your authorization model.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getCondition()`](#getcondition)
- [`getRelation()`](#getrelation)
- [`getType()`](#gettype)
- [`getWildcard()`](#getwildcard)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReference.php)
#### Implements
- [`RelationReferenceInterface`](https://github.com/evansims/openfga-php/blob/main/RelationReferenceInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [RelationReferenceInterface](https://github.com/evansims/openfga-php/blob/main/Models/RelationReferenceInterface.md) (interface)
- [RelationReferences](https://github.com/evansims/openfga-php/blob/main/Models/Collections/RelationReferences.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ------------------- | ----------- |
| `OPENAPI_MODEL` | `RelationReference` | |
#### Methods
##### getCondition
```php
public function getCondition(): ?string
```
Get the optional condition name that must be satisfied. When specified, this condition must evaluate to true for the relation reference to be valid. This enables conditional access based on runtime context and attributes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReference.php#L62)
###### Returns
`string` | `null` — The condition name, or null if no condition is required
##### getRelation
```php
public function getRelation(): ?string
```
Get the optional specific relation on the referenced type. When specified, this limits the reference to a specific relation on the target type rather than the entire type. This allows for more precise relationship definitions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReference.php#L71)
###### Returns
`string` | `null` — The relation name, or null to reference the entire type
##### getType
```php
public function getType(): string
```
Get the type being referenced. This is the object type that this reference points to. It defines which type of objects can be used in relationships through this reference.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReference.php#L80)
###### Returns
`string` — The type name being referenced
##### getWildcard
```php
public function getWildcard(): ?object
```
Get the optional wildcard marker for type-level permissions. When present, this indicates that the reference applies to all instances of the specified type, rather than specific instances. This is useful for granting permissions at the type level.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReference.php#L89)
###### Returns
`object` | `null` — The wildcard marker, or null for instance-specific references
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReference.php#L98)
###### Returns
`array`
##### schema
*<small>Implements Models\RelationReferenceInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/RelationReference.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/RelationReferenceInterface.md -->
### RelationReferenceInterface
Defines the contract for relation references with optional conditions. A relation reference specifies a particular relation within a type definition, optionally with an associated condition that must be satisfied. This allows for conditional access patterns where relationships are only valid when certain runtime conditions are met. Use this when you need to reference specific relations in your authorization model, especially when implementing attribute-based access control (ABAC) patterns.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getCondition()`](#getcondition)
- [`getRelation()`](#getrelation)
- [`getType()`](#gettype)
- [`getWildcard()`](#getwildcard)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReferenceInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [RelationReference](https://github.com/evansims/openfga-php/blob/main/Models/RelationReference.md) (implementation)
#### Methods
##### getCondition
```php
public function getCondition(): string|null
```
Get the optional condition name that must be satisfied. When specified, this condition must evaluate to true for the relation reference to be valid. This enables conditional access based on runtime context and attributes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReferenceInterface.php#L31)
###### Returns
`string` | `null` — The condition name, or null if no condition is required
##### getRelation
```php
public function getRelation(): string|null
```
Get the optional specific relation on the referenced type. When specified, this limits the reference to a specific relation on the target type rather than the entire type. This allows for more precise relationship definitions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReferenceInterface.php#L42)
###### Returns
`string` | `null` — The relation name, or null to reference the entire type
##### getType
```php
public function getType(): string
```
Get the type being referenced. This is the object type that this reference points to. It defines which type of objects can be used in relationships through this reference.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReferenceInterface.php#L52)
###### Returns
`string` — The type name being referenced
##### getWildcard
```php
public function getWildcard(): object|null
```
Get the optional wildcard marker for type-level permissions. When present, this indicates that the reference applies to all instances of the specified type, rather than specific instances. This is useful for granting permissions at the type level.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReferenceInterface.php#L63)
###### Returns
`object` | `null` — The wildcard marker, or null for instance-specific references
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/RelationReferenceInterface.php#L69)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/RelationReferenceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/SourceInfo.md -->
### SourceInfo
Represents source file information for debugging and development tools. SourceInfo provides metadata about where elements of your authorization model were originally defined, including file paths. This information is valuable for development tools, error reporting, and debugging authorization model issues. Use this when you need to trace authorization model elements back to their source definitions for debugging or tooling purposes.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getFile()`](#getfile)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/SourceInfo.php)
#### Implements
- [`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/SourceInfoInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [SourceInfoInterface](https://github.com/evansims/openfga-php/blob/main/Models/SourceInfoInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------ | ----------- |
| `OPENAPI_MODEL` | `SourceInfo` | |
#### Methods
##### getFile
```php
public function getFile(): string
```
Get the source file path where the model element was defined. This provides debugging and tooling information about the original source file location for the model element. This is particularly useful for development tools, error reporting, and tracing model definitions back to their source.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/SourceInfo.php#L65)
###### Returns
`string` — The source file path where the element was defined
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/SourceInfo.php#L74)
###### Returns
`array`
##### schema
*<small>Implements Models\SourceInfoInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/SourceInfo.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/SourceInfoInterface.md -->
### SourceInfoInterface
Represents source file information for OpenFGA model elements. Source information provides debugging and development context by tracking where model elements were originally defined. This is particularly valuable for: - Development tools that need to map runtime errors back to source files - IDE integrations that provide model editing and validation - Debugging complex authorization models with multiple source files - Error reporting that can point users to the exact source location - Model management tools that work across distributed definitions The source information is typically populated when authorization models are compiled from DSL files or other structured formats, allowing tools to maintain the connection between the runtime model and the original source definitions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getFile()`](#getfile)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/SourceInfoInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [SourceInfo](https://github.com/evansims/openfga-php/blob/main/Models/SourceInfo.md) (implementation)
#### Methods
##### getFile
```php
public function getFile(): string
```
Get the source file path where the model element was defined. This provides debugging and tooling information about the original source file location for the model element. This is particularly useful for development tools, error reporting, and tracing model definitions back to their source.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/SourceInfoInterface.php#L39)
###### Returns
`string` — The source file path where the element was defined
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/SourceInfoInterface.php#L45)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/SourceInfoInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Store.md -->
### Store
Represents an OpenFGA authorization store that contains your permission data. A Store is a container for all your authorization data - the models, relationships, and permission rules for a specific application or tenant. Each store is isolated from others, allowing you to manage permissions for different applications or environments separately. Think of a store as your application's dedicated permission database that holds all the "who can do what" information for your system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getCreatedAt()`](#getcreatedat)
- [`getDeletedAt()`](#getdeletedat)
- [`getId()`](#getid)
- [`getName()`](#getname)
- [`getUpdatedAt()`](#getupdatedat)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Store.php)
#### Implements
- [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/StoreInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [StoreInterface](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) (interface)
- [Stores](https://github.com/evansims/openfga-php/blob/main/Models/Collections/Stores.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ------- | ----------- |
| `OPENAPI_MODEL` | `Store` | |
#### Methods
##### getCreatedAt
```php
public function getCreatedAt(): DateTimeInterface
```
Get the timestamp when the store was created. The creation timestamp provides essential audit information and helps track the lifecycle of authorization stores. This timestamp is set when the store is first created through the OpenFGA API and remains immutable throughout the store's lifetime.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Store.php#L68)
###### Returns
`DateTimeInterface` — The creation timestamp in UTC timezone
##### getDeletedAt
```php
public function getDeletedAt(): ?DateTimeInterface
```
Get the timestamp when the store was deleted, if applicable. OpenFGA supports soft deletion of stores, allowing them to be marked as deleted while preserving their data for audit and recovery purposes. When a store is soft-deleted, this timestamp records when the deletion occurred. Active stores will return null for this property.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Store.php#L77)
###### Returns
`DateTimeInterface` | `null` — The deletion timestamp in UTC timezone, or null if the store is active
##### getId
```php
public function getId(): string
```
Get the unique identifier of the store. The store ID is a globally unique identifier that serves as the primary key for all operations within this authorization context. This ID is used in API requests to target specific stores and ensure isolation between different authorization domains in multi-tenant applications.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Store.php#L86)
###### Returns
`string` — The store's unique identifier
##### getName
```php
public function getName(): string
```
Get the human-readable name of the store. The store name provides a user-friendly identifier for administrative and debugging purposes. Unlike the store ID, names can be changed and are intended to be meaningful to developers and administrators managing authorization systems. Names help identify stores in dashboards, logs, and management interfaces.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Store.php#L95)
###### Returns
`string` — The store's display name
##### getUpdatedAt
```php
public function getUpdatedAt(): DateTimeInterface
```
Get the timestamp when the store was last updated. The update timestamp tracks when any changes were made to the store's metadata, such as name changes or configuration updates. This timestamp is automatically maintained by the OpenFGA service and provides important audit information for tracking store modifications over time.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Store.php#L104)
###### Returns
`DateTimeInterface` — The last update timestamp in UTC timezone
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the store for JSON encoding. This method prepares the store data for API communication, converting all properties into a format compatible with the OpenFGA API specification. Timestamps are converted to RFC3339 format in UTC timezone, ensuring consistent date handling across different systems and timezones. The resulting array contains all store properties with their API-compatible names and values, ready for transmission to the OpenFGA service or storage in JSON format.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Store.php#L113)
###### Returns
`array` — Store data formatted for JSON encoding with API-compatible field names
##### schema
*<small>Implements Models\StoreInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Store.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/StoreInterface.md -->
### StoreInterface
Represents an OpenFGA store that contains authorization models and relationship tuples. A store is a logical container for all authorization data in OpenFGA, serving as the fundamental organizational unit for authorization systems. Each store contains: - Authorization models that define the permission structure for your application - Relationship tuples that establish actual relationships between users and resources - Configuration and metadata for authorization behavior Stores provide complete isolation between different authorization contexts, making them ideal for multi-tenant applications where different customers, organizations, or environments need separate authorization domains. Each store operates independently with its own set of models, tuples, and access patterns. The store lifecycle includes creation, updates, and optional soft deletion, with comprehensive timestamp tracking for audit and debugging purposes. Stores can be managed through the OpenFGA management API and serve as the target for all authorization queries and relationship operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getCreatedAt()`](#getcreatedat)
- [`getDeletedAt()`](#getdeletedat)
- [`getId()`](#getid)
- [`getName()`](#getname)
- [`getUpdatedAt()`](#getupdatedat)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/StoreInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Store](https://github.com/evansims/openfga-php/blob/main/Models/Store.md) (implementation)
#### Methods
##### getCreatedAt
```php
public function getCreatedAt(): DateTimeInterface
```
Get the timestamp when the store was created. The creation timestamp provides essential audit information and helps track the lifecycle of authorization stores. This timestamp is set when the store is first created through the OpenFGA API and remains immutable throughout the store's lifetime.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/StoreInterface.php#L44)
###### Returns
`DateTimeInterface` — The creation timestamp in UTC timezone
##### getDeletedAt
```php
public function getDeletedAt(): DateTimeInterface|null
```
Get the timestamp when the store was deleted, if applicable. OpenFGA supports soft deletion of stores, allowing them to be marked as deleted while preserving their data for audit and recovery purposes. When a store is soft-deleted, this timestamp records when the deletion occurred. Active stores will return null for this property.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/StoreInterface.php#L56)
###### Returns
`DateTimeInterface` | `null` — The deletion timestamp in UTC timezone, or null if the store is active
##### getId
```php
public function getId(): string
```
Get the unique identifier of the store. The store ID is a globally unique identifier that serves as the primary key for all operations within this authorization context. This ID is used in API requests to target specific stores and ensure isolation between different authorization domains in multi-tenant applications.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/StoreInterface.php#L68)
###### Returns
`string` — The store's unique identifier
##### getName
```php
public function getName(): string
```
Get the human-readable name of the store. The store name provides a user-friendly identifier for administrative and debugging purposes. Unlike the store ID, names can be changed and are intended to be meaningful to developers and administrators managing authorization systems. Names help identify stores in dashboards, logs, and management interfaces.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/StoreInterface.php#L80)
###### Returns
`string` — The store's display name
##### getUpdatedAt
```php
public function getUpdatedAt(): DateTimeInterface
```
Get the timestamp when the store was last updated. The update timestamp tracks when any changes were made to the store's metadata, such as name changes or configuration updates. This timestamp is automatically maintained by the OpenFGA service and provides important audit information for tracking store modifications over time.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/StoreInterface.php#L92)
###### Returns
`DateTimeInterface` — The last update timestamp in UTC timezone
##### jsonSerialize
```php
public function jsonSerialize(): array<'created_at'|'deleted_at'|'id'|'name'|'updated_at', string>
```
Serialize the store for JSON encoding. This method prepares the store data for API communication, converting all properties into a format compatible with the OpenFGA API specification. Timestamps are converted to RFC3339 format in UTC timezone, ensuring consistent date handling across different systems and timezones. The resulting array contains all store properties with their API-compatible names and values, ready for transmission to the OpenFGA service or storage in JSON format.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/StoreInterface.php#L109)
###### Returns
`array<'created_at'` | `'deleted_at'` | `'id'` | `'name'` | `'updated_at', string>` — Store data formatted for JSON encoding with API-compatible field names
<!-- End of evansims/openfga-php/docs/API/Models/StoreInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Tuple.md -->
### Tuple
Represents a stored relationship tuple in your authorization system. A Tuple is a relationship record that exists in your OpenFGA store, representing a specific connection between a user, relation, and object (like "user:anne is reader of document:budget"). Unlike TupleKey which just describes the relationship, Tuple includes the timestamp when the relationship was established. Use this when working with actual stored relationships in your system, particularly when you need to know when relationships were created.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getKey()`](#getkey)
- [`getTimestamp()`](#gettimestamp)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Tuple.php)
#### Implements
- [`TupleInterface`](https://github.com/evansims/openfga-php/blob/main/TupleInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [TupleInterface](https://github.com/evansims/openfga-php/blob/main/Models/TupleInterface.md) (interface)
- [Tuples](https://github.com/evansims/openfga-php/blob/main/Models/Collections/Tuples.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ------- | ----------- |
| `OPENAPI_MODEL` | `Tuple` | |
#### Methods
##### getKey
```php
public function getKey(): OpenFGA\Models\TupleKeyInterface
```
Get the tuple key that identifies the relationship. The tuple key contains the essential components that define a relationship within the OpenFGA authorization system. It includes the user (subject), relation (permission type), object (resource), and optional condition that together uniquely identify this specific authorization relationship. The tuple key serves as the primary identifier for relationship operations and is used in authorization queries to match against permission requests. All authorization decisions ultimately trace back to evaluating these relationship keys against the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Tuple.php#L60)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeyInterface.md) — The tuple key defining this relationship with user, relation, object, and optional condition
##### getTimestamp
```php
public function getTimestamp(): DateTimeImmutable
```
Get the timestamp when this tuple was created or last modified. Timestamps provide essential audit information for relationship tracking, enabling debugging, compliance reporting, and temporal analysis of authorization changes. The timestamp is set by the OpenFGA service when the tuple is written and reflects the precise moment the relationship was established or updated. These timestamps are particularly valuable for: - Audit trails and compliance reporting - Debugging authorization issues - Understanding the evolution of permissions over time - Implementing time-based access controls
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Tuple.php#L69)
###### Returns
`DateTimeImmutable` — The creation or last modification timestamp in UTC timezone
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the tuple for JSON encoding. This method prepares the tuple data for API communication with the OpenFGA service, converting the tuple key and timestamp into the format expected by the OpenFGA API. The tuple key is serialized to include all relationship components (user, relation, object, and optional condition), while the timestamp is formatted as an RFC3339 string in UTC timezone. The resulting structure matches the OpenFGA API specification for tuple objects, ensuring seamless integration with write operations, read queries, and other tuple-related API endpoints.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Tuple.php#L78)
###### Returns
`array` — Tuple data formatted for JSON encoding with API-compatible structure
##### schema
*<small>Implements Models\TupleInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Tuple.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TupleChange.md -->
### TupleChange
Represents a change to a relationship tuple in your authorization store. When you modify relationships in OpenFGA (adding or removing tuples), each change is tracked as a TupleChange. This allows you to see the history of authorization changes, audit permissions over time, and understand when relationships were established or removed. Use this when you need to track or review the history of relationship changes in your application, such as for compliance auditing or debugging permission issues.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getOperation()`](#getoperation)
- [`getTimestamp()`](#gettimestamp)
- [`getTupleKey()`](#gettuplekey)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChange.php)
#### Implements
- [`TupleChangeInterface`](https://github.com/evansims/openfga-php/blob/main/TupleChangeInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [TupleChangeInterface](https://github.com/evansims/openfga-php/blob/main/Models/TupleChangeInterface.md) (interface)
- [TupleChanges](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleChanges.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ------------- | ----------- |
| `OPENAPI_MODEL` | `TupleChange` | |
#### Methods
##### getOperation
```php
public function getOperation(): OpenFGA\Models\Enums\TupleOperation
```
Get the type of operation performed on the tuple. Operations indicate whether the tuple was written (created) or deleted from the authorization store. This information is crucial for understanding the nature of the change.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChange.php#L80)
###### Returns
[`TupleOperation`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/TupleOperation.md) — The operation type (write or delete)
##### getTimestamp
```php
public function getTimestamp(): DateTimeImmutable
```
Get the timestamp when this tuple change occurred. Timestamps help track the chronological order of changes and provide audit trail capabilities. They are essential for understanding the sequence of relationship modifications.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChange.php#L89)
###### Returns
`DateTimeImmutable` — The change timestamp
##### getTupleKey
```php
public function getTupleKey(): OpenFGA\Models\TupleKeyInterface
```
Get the tuple key that was affected by this change. The tuple key identifies which specific relationship was created or deleted, containing the user, relation, object, and optional condition information.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChange.php#L98)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeyInterface.md) — The tuple key that was modified
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChange.php#L107)
###### Returns
`array`
##### schema
*<small>Implements Models\TupleChangeInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/TupleChange.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TupleChangeInterface.md -->
### TupleChangeInterface
Represents a change event for a relationship tuple in OpenFGA. Tuple changes capture the history of relationship modifications in the authorization store. Each change records whether a tuple was written (created) or deleted, along with the timestamp and the specific tuple that was affected. These change events are essential for: - Auditing relationship modifications - Implementing consistency across distributed systems - Debugging authorization issues - Maintaining change history for compliance
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getOperation()`](#getoperation)
- [`getTimestamp()`](#gettimestamp)
- [`getTupleKey()`](#gettuplekey)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChangeInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [TupleChange](https://github.com/evansims/openfga-php/blob/main/Models/TupleChange.md) (implementation)
#### Methods
##### getOperation
```php
public function getOperation(): TupleOperation
```
Get the type of operation performed on the tuple. Operations indicate whether the tuple was written (created) or deleted from the authorization store. This information is crucial for understanding the nature of the change.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChangeInterface.php#L39)
###### Returns
[`TupleOperation`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/TupleOperation.md) — The operation type (write or delete)
##### getTimestamp
```php
public function getTimestamp(): DateTimeImmutable
```
Get the timestamp when this tuple change occurred. Timestamps help track the chronological order of changes and provide audit trail capabilities. They are essential for understanding the sequence of relationship modifications.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChangeInterface.php#L50)
###### Returns
`DateTimeImmutable` — The change timestamp
##### getTupleKey
```php
public function getTupleKey(): TupleKeyInterface
```
Get the tuple key that was affected by this change. The tuple key identifies which specific relationship was created or deleted, containing the user, relation, object, and optional condition information.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChangeInterface.php#L61)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeyInterface.md) — The tuple key that was modified
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleChangeInterface.php#L67)
###### Returns
`array<`string`, `mixed`>`
<!-- End of evansims/openfga-php/docs/API/Models/TupleChangeInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TupleInterface.md -->
### TupleInterface
Represents a relationship tuple in the OpenFGA authorization system. Tuples are the fundamental building blocks of OpenFGA that define actual relationships between users, objects, and relations. They represent concrete facts about your system, such as "user:alice has editor relation to document:doc1" or "group:engineering has member relation to user:bob." These relationships form the data foundation that OpenFGA uses during authorization checks to determine access permissions and evaluate complex authorization policies. Each tuple consists of: - A tuple key that defines the relationship (user, relation, object, optional condition) - A timestamp that tracks when the relationship was established or last modified Tuples can be unconditional (always valid) or conditional (valid only when specific runtime conditions are met). Conditional tuples enable dynamic authorization based on context such as time of day, resource attributes, or environmental factors. The tuple system supports OpenFGA's core authorization model by providing the actual relationship data that authorization queries evaluate against. Tuples are managed through write operations and queried during check operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getKey()`](#getkey)
- [`getTimestamp()`](#gettimestamp)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Tuple](https://github.com/evansims/openfga-php/blob/main/Models/Tuple.md) (implementation)
#### Methods
##### getKey
```php
public function getKey(): TupleKeyInterface
```
Get the tuple key that identifies the relationship. The tuple key contains the essential components that define a relationship within the OpenFGA authorization system. It includes the user (subject), relation (permission type), object (resource), and optional condition that together uniquely identify this specific authorization relationship. The tuple key serves as the primary identifier for relationship operations and is used in authorization queries to match against permission requests. All authorization decisions ultimately trace back to evaluating these relationship keys against the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleInterface.php#L54)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeyInterface.md) — The tuple key defining this relationship with user, relation, object, and optional condition
##### getTimestamp
```php
public function getTimestamp(): DateTimeImmutable
```
Get the timestamp when this tuple was created or last modified. Timestamps provide essential audit information for relationship tracking, enabling debugging, compliance reporting, and temporal analysis of authorization changes. The timestamp is set by the OpenFGA service when the tuple is written and reflects the precise moment the relationship was established or updated. These timestamps are particularly valuable for: - Audit trails and compliance reporting - Debugging authorization issues - Understanding the evolution of permissions over time - Implementing time-based access controls
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleInterface.php#L73)
###### Returns
`DateTimeImmutable` — The creation or last modification timestamp in UTC timezone
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the tuple for JSON encoding. This method prepares the tuple data for API communication with the OpenFGA service, converting the tuple key and timestamp into the format expected by the OpenFGA API. The tuple key is serialized to include all relationship components (user, relation, object, and optional condition), while the timestamp is formatted as an RFC3339 string in UTC timezone. The resulting structure matches the OpenFGA API specification for tuple objects, ensuring seamless integration with write operations, read queries, and other tuple-related API endpoints.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleInterface.php#L91)
###### Returns
`array<`string`, `mixed`>` — Tuple data formatted for JSON encoding with API-compatible structure
<!-- End of evansims/openfga-php/docs/API/Models/TupleInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TupleKey.md -->
### TupleKey
Represents a relationship tuple key defining a connection between user, relation, and object. A TupleKey is the fundamental unit of authorization in OpenFGA, representing a specific relationship like "user:anne is reader of document:budget." It consists of three parts: user (who), relation (what type of access), and object (what resource), optionally with conditions for attribute-based access. Use this when creating, querying, or managing specific relationships in your authorization system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getCondition()`](#getcondition)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`getUser()`](#getuser)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKey.php)
#### Implements
- [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/TupleKeyInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [TupleKeyInterface](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) (interface)
- [TupleKeys](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeys.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ---------- | ----------- |
| `OPENAPI_MODEL` | `TupleKey` | |
#### Methods
##### getCondition
```php
public function getCondition(): ?OpenFGA\Models\ConditionInterface
```
Get the condition that constrains this relationship. Conditions enable dynamic authorization by allowing relationships to be conditional based on runtime context, such as time of day, resource attributes, or other factors. When a condition is present, the relationship is only valid when the condition evaluates to true.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKey.php#L80)
###### Returns
[`ConditionInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionInterface.md) | `null` — The condition that must be satisfied for this relationship to be valid, or null for an unconditional relationship
##### getObject
```php
public function getObject(): string
```
Get the object in this relationship tuple. The object represents the resource or entity that the permission or relationship applies to. For example, in "user:alice can view document:readme," the object would be "document:readme." Objects are typically formatted as "type:id" where type describes the kind of resource.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKey.php#L89)
###### Returns
`string` — The object identifier
##### getRelation
```php
public function getRelation(): string
```
Get the relation that defines the type of relationship. The relation describes what kind of permission or relationship exists between the user and object. For example, common relations include "owner," "viewer," "editor," "can_read," "can_write." Relations are defined in your authorization model and determine what actions are permitted.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKey.php#L98)
###### Returns
`string` — The relation name defining the type of relationship
##### getUser
```php
public function getUser(): string
```
Get the user (subject) in this relationship tuple. The user represents the entity that has the relationship to the object. This can be an individual user, a group, a role, or any other subject defined in your authorization model. For example, in "user:alice can view document:readme," the user would be "user:alice."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKey.php#L107)
###### Returns
`string` — The user identifier
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the tuple key for JSON encoding. This method prepares the tuple key data for API requests or storage, ensuring all components (user, relation, object, and optional condition) are properly formatted according to the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKey.php#L116)
###### Returns
`array` — The serialized tuple key data ready for JSON encoding
##### schema
*<small>Implements Models\TupleKeyInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/TupleKey.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TupleKeyInterface.md -->
### TupleKeyInterface
Represents a tuple key that defines the components of a relationship in OpenFGA. Tuple keys are the core data structure that defines relationships in the OpenFGA authorization system. They specify the essential components that together describe an authorization relationship: who (user), what (relation), and where (object), with optional conditional logic (condition). The tuple key structure follows the pattern: - **User**: The subject of the relationship (who has the permission) - **Relation**: The type of permission or relationship being defined - **Object**: The resource or entity the permission applies to - **Condition**: Optional runtime constraints that must be satisfied Examples of tuple keys: - `user:alice` has `editor` relation to `document:readme` - `group:engineering` has `member` relation to `user:bob` - `user:contractor` has `read` relation to `file:confidential` when `time_constraint` is met Tuple keys are used throughout OpenFGA operations: - Writing relationships (creating authorization facts) - Reading relationships (querying existing permissions) - Authorization checks (evaluating access requests) - Relationship expansion (understanding permission inheritance) The flexible tuple key design enables OpenFGA to represent complex authorization patterns while maintaining efficient query performance and clear relationship semantics.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getCondition()`](#getcondition)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`getUser()`](#getuser)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKeyInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [TupleKey](https://github.com/evansims/openfga-php/blob/main/Models/TupleKey.md) (implementation)
#### Methods
##### getCondition
```php
public function getCondition(): ConditionInterface|null
```
Get the condition that constrains this relationship. Conditions enable dynamic authorization by allowing relationships to be conditional based on runtime context, such as time of day, resource attributes, or other factors. When a condition is present, the relationship is only valid when the condition evaluates to true.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKeyInterface.php#L52)
###### Returns
[`ConditionInterface`](https://github.com/evansims/openfga-php/blob/main/ConditionInterface.md) | `null` — The condition that must be satisfied for this relationship to be valid, or null for an unconditional relationship
##### getObject
```php
public function getObject(): string
```
Get the object in this relationship tuple. The object represents the resource or entity that the permission or relationship applies to. For example, in "user:alice can view document:readme," the object would be "document:readme." Objects are typically formatted as "type:id" where type describes the kind of resource.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKeyInterface.php#L63)
###### Returns
`string` — The object identifier
##### getRelation
```php
public function getRelation(): string
```
Get the relation that defines the type of relationship. The relation describes what kind of permission or relationship exists between the user and object. For example, common relations include "owner," "viewer," "editor," "can_read," "can_write." Relations are defined in your authorization model and determine what actions are permitted.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKeyInterface.php#L74)
###### Returns
`string` — The relation name defining the type of relationship
##### getUser
```php
public function getUser(): string
```
Get the user (subject) in this relationship tuple. The user represents the entity that has the relationship to the object. This can be an individual user, a group, a role, or any other subject defined in your authorization model. For example, in "user:alice can view document:readme," the user would be "user:alice."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKeyInterface.php#L85)
###### Returns
`string` — The user identifier
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the tuple key for JSON encoding. This method prepares the tuple key data for API requests or storage, ensuring all components (user, relation, object, and optional condition) are properly formatted according to the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleKeyInterface.php#L97)
###### Returns
`array<`string`, `mixed`>` — The serialized tuple key data ready for JSON encoding
<!-- End of evansims/openfga-php/docs/API/Models/TupleKeyInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TupleToUsersetV1.md -->
### TupleToUsersetV1
Represents a tuple-to-userset relationship that derives permissions from related objects. This enables complex authorization patterns where permissions on one object are determined by relationships with other objects. For example, "users who can edit a document are those who are owners of the folder containing it". The tupleset defines which related objects to look at, and computedUserset specifies which relationship on those objects grants the permission.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getComputedUserset()`](#getcomputeduserset)
- [`getTupleset()`](#gettupleset)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1.php)
#### Implements
- [`TupleToUsersetV1Interface`](https://github.com/evansims/openfga-php/blob/main/TupleToUsersetV1Interface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [TupleToUsersetV1Interface](https://github.com/evansims/openfga-php/blob/main/Models/TupleToUsersetV1Interface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------------- | ----------- |
| `OPENAPI_MODEL` | `v1.TupleToUserset` | |
#### Methods
##### getComputedUserset
```php
public function getComputedUserset(): OpenFGA\Models\ObjectRelationInterface
```
Get the userset that will be computed based on the tupleset. This represents the object-relation pair that defines which userset should be computed for each tuple found in the tupleset. The computed userset determines the final set of users resulting from the tuple-to-userset operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1.php#L55)
###### Returns
[`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/ObjectRelationInterface.md) — The object-relation pair defining the computed userset
##### getTupleset
```php
public function getTupleset(): OpenFGA\Models\ObjectRelationInterface
```
Get the tupleset (object-relation pair) that defines which tuples to use for computation. This represents the object-relation pair that identifies which tuples should be examined to compute the final userset. For each matching tuple, the computed userset will be evaluated to determine the resulting users.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1.php#L64)
###### Returns
[`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/ObjectRelationInterface.md) — The object-relation pair defining the tupleset
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1.php#L73)
###### Returns
`array`
##### schema
*<small>Implements Models\TupleToUsersetV1Interface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/TupleToUsersetV1.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TupleToUsersetV1Interface.md -->
### TupleToUsersetV1Interface
Defines a tuple-to-userset operation in authorization models. TupleToUsersetV1 represents an authorization operation that computes usersets by following relationships from one object type to usersets on related objects. This enables complex authorization patterns like "users who can view a document are the editors of the parent folder" or "viewers of a resource are the members of the associated organization". Use this interface when implementing authorization models that involve indirect relationships through tuple-to-userset operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getComputedUserset()`](#getcomputeduserset)
- [`getTupleset()`](#gettupleset)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1Interface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [TupleToUsersetV1](https://github.com/evansims/openfga-php/blob/main/Models/TupleToUsersetV1.md) (implementation)
#### Methods
##### getComputedUserset
```php
public function getComputedUserset(): ObjectRelationInterface
```
Get the userset that will be computed based on the tupleset. This represents the object-relation pair that defines which userset should be computed for each tuple found in the tupleset. The computed userset determines the final set of users resulting from the tuple-to-userset operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1Interface.php#L32)
###### Returns
[`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/ObjectRelationInterface.md) — The object-relation pair defining the computed userset
##### getTupleset
```php
public function getTupleset(): ObjectRelationInterface
```
Get the tupleset (object-relation pair) that defines which tuples to use for computation. This represents the object-relation pair that identifies which tuples should be examined to compute the final userset. For each matching tuple, the computed userset will be evaluated to determine the resulting users.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1Interface.php#L43)
###### Returns
[`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/ObjectRelationInterface.md) — The object-relation pair defining the tupleset
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TupleToUsersetV1Interface.php#L49)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/TupleToUsersetV1Interface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TypeDefinition.md -->
### TypeDefinition
Represents a type definition in your authorization model. A TypeDefinition defines an object type (like "document," "folder," "user") and specifies the relations that can exist for objects of this type. Each relation defines how users can be related to objects, such as "owner," "editor," or "viewer" relationships. Use this when defining the schema of object types and their allowed relationships in your authorization model.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getMetadata()`](#getmetadata)
- [`getRelations()`](#getrelations)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinition.php)
#### Implements
- [`TypeDefinitionInterface`](https://github.com/evansims/openfga-php/blob/main/TypeDefinitionInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [TypeDefinitionInterface](https://github.com/evansims/openfga-php/blob/main/Models/TypeDefinitionInterface.md) (interface)
- [TypeDefinitions](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitions.md) (collection)
#### Constants
| Name | Value | Description |
| --------------- | ---------------- | ----------- |
| `OPENAPI_MODEL` | `TypeDefinition` | |
#### Methods
##### getMetadata
```php
public function getMetadata(): ?OpenFGA\Models\MetadataInterface
```
Get the metadata associated with this type definition. Metadata provides additional context, documentation, and configuration information for the type definition. This can include source file information, module details, and other development-time context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinition.php#L61)
###### Returns
[`MetadataInterface`](https://github.com/evansims/openfga-php/blob/main/MetadataInterface.md) | `null` — The metadata, or null if not specified
##### getRelations
```php
public function getRelations(): ?OpenFGA\Models\Collections\TypeDefinitionRelationsInterface
```
Get the collection of relations defined for this type. Relations define the authorized relationships that can exist between objects of this type and other entities in the system.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinition.php#L70)
###### Returns
[`TypeDefinitionRelationsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionRelationsInterface.md) | `null` — The relations collection or null if no relations are defined
##### getType
```php
public function getType(): string
```
Get the name of this type. The type name uniquely identifies this type definition within the authorization model. Common examples include "user," "document," "folder," "organization," etc.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinition.php#L79)
###### Returns
`string` — The unique type name
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinition.php#L88)
###### Returns
`array`
##### schema
*<small>Implements Models\TypeDefinitionInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/TypeDefinition.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TypeDefinitionInterface.md -->
### TypeDefinitionInterface
Represents a type definition in an OpenFGA authorization model. Type definitions are the building blocks of authorization models that define the types of objects in your system and the relationships that can exist between them. Each type definition specifies: - The type name (for example "document," "user," "organization") - The relations that objects of this type can have (for example "viewer," "editor," "owner") - Optional metadata for additional context and configuration Type definitions form the schema that OpenFGA uses to understand your permission model and validate authorization queries.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getMetadata()`](#getmetadata)
- [`getRelations()`](#getrelations)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinitionInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [TypeDefinition](https://github.com/evansims/openfga-php/blob/main/Models/TypeDefinition.md) (implementation)
#### Methods
##### getMetadata
```php
public function getMetadata(): MetadataInterface|null
```
Get the metadata associated with this type definition. Metadata provides additional context, documentation, and configuration information for the type definition. This can include source file information, module details, and other development-time context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinitionInterface.php#L39)
###### Returns
[`MetadataInterface`](https://github.com/evansims/openfga-php/blob/main/MetadataInterface.md) | `null` — The metadata, or null if not specified
##### getRelations
```php
public function getRelations(): TypeDefinitionRelationsInterface|null
```
Get the collection of relations defined for this type. Relations define the authorized relationships that can exist between objects of this type and other entities in the system.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinitionInterface.php#L49)
###### Returns
[`TypeDefinitionRelationsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionRelationsInterface.md) | `null` — The relations collection or null if no relations are defined
##### getType
```php
public function getType(): string
```
Get the name of this type. The type name uniquely identifies this type definition within the authorization model. Common examples include "user," "document," "folder," "organization," etc.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinitionInterface.php#L60)
###### Returns
`string` — The unique type name
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypeDefinitionInterface.php#L66)
###### Returns
`array<`string`, `mixed`>`
<!-- End of evansims/openfga-php/docs/API/Models/TypeDefinitionInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TypedWildcard.md -->
### TypedWildcard
Represents a wildcard that matches all users of a specific type. In authorization models, you sometimes want to grant permissions to all users of a certain type rather than specific individuals. TypedWildcard lets you specify "all users of type X" in your authorization rules. For example, you might want to grant read access to "all employees" or "all customers" without having to list each individual user.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TypedWildcard.php)
#### Implements
- [`TypedWildcardInterface`](https://github.com/evansims/openfga-php/blob/main/TypedWildcardInterface.md)
- `Stringable`
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [TypedWildcardInterface](https://github.com/evansims/openfga-php/blob/main/Models/TypedWildcardInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | --------------- | ----------- |
| `OPENAPI_MODEL` | `TypedWildcard` | |
#### Methods
##### getType
```php
public function getType(): string
```
Get the object type that this wildcard represents. This returns the type name for which the wildcard grants access to all users of that type. For example, "user" would represent all users, "group" would represent all groups, etc.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypedWildcard.php#L81)
###### Returns
`string` — The object type that this wildcard represents
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypedWildcard.php#L90)
###### Returns
`array`
##### schema
*<small>Implements Models\TypedWildcardInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/TypedWildcard.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/TypedWildcardInterface.md -->
### TypedWildcardInterface
Defines the contract for typed wildcard specifications. A typed wildcard represents "all users of a specific type" in authorization rules. Instead of listing individual users, you can grant permissions to all members of a user type (like "all employees" or "all customers"). Use this when you want to create broad permission grants that automatically apply to all users of a particular type without explicit enumeration.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/TypedWildcardInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `Stringable`
- `JsonSerializable`
#### Related Classes
- [TypedWildcard](https://github.com/evansims/openfga-php/blob/main/Models/TypedWildcard.md) (implementation)
#### Methods
##### getType
```php
public function getType(): string
```
Get the object type that this wildcard represents. This returns the type name for which the wildcard grants access to all users of that type. For example, "user" would represent all users, "group" would represent all groups, etc.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypedWildcardInterface.php#L41)
###### Returns
`string` — The object type that this wildcard represents
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/TypedWildcardInterface.php#L47)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/TypedWildcardInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/User.md -->
### User
Represents a user or user specification in authorization contexts. A User can represent different types of entities in your authorization system: a specific user object, a userset (group of users), a wildcard (all users of a type), or a complex difference operation between user groups. This flexible model allows OpenFGA to handle various user identification patterns, from simple "user:alice" references to complex computed user groups based on relationships and rules.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getDifference()`](#getdifference)
- [`getObject()`](#getobject)
- [`getUserset()`](#getuserset)
- [`getWildcard()`](#getwildcard)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/User.php)
#### Implements
- [`UserInterface`](https://github.com/evansims/openfga-php/blob/main/UserInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UserInterface](https://github.com/evansims/openfga-php/blob/main/Models/UserInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------ | ----------- |
| `OPENAPI_MODEL` | `User` | |
#### Methods
##### getDifference
```php
public function getDifference(): ?OpenFGA\Models\DifferenceV1Interface
```
Get the difference operation for this user. Difference operations enable sophisticated access control by subtracting one set of users from another, creating complex user definitions that include some users while explicitly excluding others. For example, "all editors except contractors" or "all organization members except suspended users." This pattern is particularly useful for: - Implementing exception-based access policies - Temporary access restrictions without modifying base permissions - Complex organizational hierarchies with exclusion rules - Compliance scenarios requiring explicit user exclusions When a difference operation is present, the authorization system evaluates both the base user set and the excluded user set, granting access only to users who match the base set but not the exclusion set.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/User.php#L67)
###### Returns
[`DifferenceV1Interface`](https://github.com/evansims/openfga-php/blob/main/DifferenceV1Interface.md) | `null` — The difference operation defining included and excluded user sets, or null if this is not a difference-based user
##### getObject
```php
public function getObject(): ?OpenFGA\Models\UserObjectInterface|string|null
```
Get the user object representation. User objects represent direct, concrete user identifiers within the authorization system. These can be structured objects with explicit type and ID properties, or simple string identifiers following the "type:id" convention for backward compatibility and convenience. Examples of user object representations: - Structured: UserObject with type="user" and id="alice" - String format: "user:alice," "service:backup-agent," "bot:notification-service" Direct user objects are the most straightforward way to assign permissions to specific, known entities in your system. They provide clear, unambiguous identification and are efficient for authorization queries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/User.php#L76)
###### Returns
[`UserObjectInterface`](https://github.com/evansims/openfga-php/blob/main/UserObjectInterface.md) | `null` | `string` | `null` — The direct user identifier as a structured object or string, or null if this is not a direct user reference
##### getUserset
```php
public function getUserset(): ?OpenFGA\Models\UsersetUserInterface
```
Get the userset reference for this user. Usersets define dynamic user groups through relationships to other objects, enabling permissions that automatically adapt as relationships change in your system. A userset specifies users indirectly by describing a relationship pattern, such as "all editors of document:readme" or "all members of group:engineering." Usersets are powerful because they: - Automatically include/exclude users as relationships change - Reduce the need for explicit permission management - Enable permission inheritance and delegation patterns - Support complex organizational structures and role hierarchies When authorization checks encounter usersets, OpenFGA recursively evaluates the referenced relationships to determine the actual set of users that have access through this indirect relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/User.php#L132)
###### Returns
[`UsersetUserInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetUserInterface.md) | `null` — The userset definition specifying users through relationships, or null if this is not a userset-based user
##### getWildcard
```php
public function getWildcard(): ?OpenFGA\Models\TypedWildcardInterface
```
Get the wildcard definition for this user. Wildcards represent all users of a specific type, enabling broad, type-based permissions without enumerating individual users. This pattern is particularly useful for organization-wide permissions, public access scenarios, or when you want to grant access to all users matching certain criteria. Common wildcard use cases: - "All employees can access the company directory" - "All authenticated users can read public documents" - "All service accounts can write to audit logs" - "All users in the organization can view the org chart" Wildcards are efficient for authorization because they don't require maintaining explicit relationships for every user, while still providing type-safe access control based on user categorization.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/User.php#L141)
###### Returns
[`TypedWildcardInterface`](https://github.com/evansims/openfga-php/blob/main/TypedWildcardInterface.md) | `null` — The wildcard definition specifying the user type, or null if this is not a wildcard user
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the user for JSON encoding. This method prepares the user data for API communication with the OpenFGA service, converting the user representation into the format expected by the OpenFGA API. The serialization handles all user types (direct objects, usersets, wildcards, and difference operations) and ensures the resulting structure matches the OpenFGA API specification. Only the appropriate user type fields are included in the output: - Direct users include object field with type:id or structured object - Usersets include userset field with type, id, and relation - Wildcards include wildcard field with type specification - Difference operations include difference field with base and subtract sets
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/User.php#L152)
###### Returns
`array<`string`, `mixed`>` — User data formatted for JSON encoding with the appropriate user type representation
##### schema
*<small>Implements Models\UserInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/User.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UserInterface.md -->
### UserInterface
Represents a user in an OpenFGA authorization model. In OpenFGA, users are flexible entities that can represent various types of subjects in authorization relationships. The user concept extends beyond individual people to include groups, roles, services, or any entity that can be granted permissions. OpenFGA supports multiple user representation patterns to accommodate complex authorization scenarios: Direct User Objects**: Simple user identifiers in "type:id" format, such as "user:alice" or "service:backup-agent." These represent concrete entities with specific identities that can be directly assigned permissions. Usersets**: Dynamic user groups defined through relationships, such as "all editors of document:readme" or "all members of group:engineering." Usersets enable permissions that automatically adapt as relationships change. Wildcards**: Type-based user groups that match all users of a specific type, such as "all users of type employee." Wildcards enable broad, organization-wide permissions without enumerating individual users. Difference Operations**: Complex user definitions that include some users while excluding others, such as "all editors except contractors." This enables fine-grained access control with exception handling. This flexible user model enables OpenFGA to handle sophisticated authorization patterns while maintaining performance and simplicity in common use cases.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getDifference()`](#getdifference)
- [`getObject()`](#getobject)
- [`getUserset()`](#getuserset)
- [`getWildcard()`](#getwildcard)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UserInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [User](https://github.com/evansims/openfga-php/blob/main/Models/User.md) (implementation)
#### Methods
##### getDifference
```php
public function getDifference(): DifferenceV1Interface|null
```
Get the difference operation for this user. Difference operations enable sophisticated access control by subtracting one set of users from another, creating complex user definitions that include some users while explicitly excluding others. For example, "all editors except contractors" or "all organization members except suspended users." This pattern is particularly useful for: - Implementing exception-based access policies - Temporary access restrictions without modifying base permissions - Complex organizational hierarchies with exclusion rules - Compliance scenarios requiring explicit user exclusions When a difference operation is present, the authorization system evaluates both the base user set and the excluded user set, granting access only to users who match the base set but not the exclusion set.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserInterface.php#L62)
###### Returns
[`DifferenceV1Interface`](https://github.com/evansims/openfga-php/blob/main/DifferenceV1Interface.md) | `null` — The difference operation defining included and excluded user sets, or null if this is not a difference-based user
##### getObject
```php
public function getObject(): string|UserObjectInterface|null
```
Get the user object representation. User objects represent direct, concrete user identifiers within the authorization system. These can be structured objects with explicit type and ID properties, or simple string identifiers following the "type:id" convention for backward compatibility and convenience. Examples of user object representations: - Structured: UserObject with type="user" and id="alice" - String format: "user:alice," "service:backup-agent," "bot:notification-service" Direct user objects are the most straightforward way to assign permissions to specific, known entities in your system. They provide clear, unambiguous identification and are efficient for authorization queries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserInterface.php#L82)
###### Returns
`string` | [`UserObjectInterface`](https://github.com/evansims/openfga-php/blob/main/UserObjectInterface.md) | `null` — The direct user identifier as a structured object or string, or null if this is not a direct user reference
##### getUserset
```php
public function getUserset(): UsersetUserInterface|null
```
Get the userset reference for this user. Usersets define dynamic user groups through relationships to other objects, enabling permissions that automatically adapt as relationships change in your system. A userset specifies users indirectly by describing a relationship pattern, such as "all editors of document:readme" or "all members of group:engineering." Usersets are powerful because they: - Automatically include/exclude users as relationships change - Reduce the need for explicit permission management - Enable permission inheritance and delegation patterns - Support complex organizational structures and role hierarchies When authorization checks encounter usersets, OpenFGA recursively evaluates the referenced relationships to determine the actual set of users that have access through this indirect relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserInterface.php#L104)
###### Returns
[`UsersetUserInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetUserInterface.md) | `null` — The userset definition specifying users through relationships, or null if this is not a userset-based user
##### getWildcard
```php
public function getWildcard(): TypedWildcardInterface|null
```
Get the wildcard definition for this user. Wildcards represent all users of a specific type, enabling broad, type-based permissions without enumerating individual users. This pattern is particularly useful for organization-wide permissions, public access scenarios, or when you want to grant access to all users matching certain criteria. Common wildcard use cases: - "All employees can access the company directory" - "All authenticated users can read public documents" - "All service accounts can write to audit logs" - "All users in the organization can view the org chart" Wildcards are efficient for authorization because they don't require maintaining explicit relationships for every user, while still providing type-safe access control based on user categorization.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserInterface.php#L126)
###### Returns
[`TypedWildcardInterface`](https://github.com/evansims/openfga-php/blob/main/TypedWildcardInterface.md) | `null` — The wildcard definition specifying the user type, or null if this is not a wildcard user
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
Serialize the user for JSON encoding. This method prepares the user data for API communication with the OpenFGA service, converting the user representation into the format expected by the OpenFGA API. The serialization handles all user types (direct objects, usersets, wildcards, and difference operations) and ensures the resulting structure matches the OpenFGA API specification. Only the appropriate user type fields are included in the output: - Direct users include object field with type:id or structured object - Usersets include userset field with type, id, and relation - Wildcards include wildcard field with type specification - Difference operations include difference field with base and subtract sets
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserInterface.php#L146)
###### Returns
`array<`string`, `mixed`>` — User data formatted for JSON encoding with the appropriate user type representation
<!-- End of evansims/openfga-php/docs/API/Models/UserInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UserObject.md -->
### UserObject
Represents a specific user object with type and identifier. A UserObject provides a structured way to represent users in your authorization system with both a type (like "user," "service," "bot") and a unique identifier. This allows for clear categorization of different kinds of entities that can have permissions in your system. Use this when you need to represent users in a structured format rather than simple string identifiers.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getId()`](#getid)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObject.php)
#### Implements
- [`UserObjectInterface`](https://github.com/evansims/openfga-php/blob/main/UserObjectInterface.md)
- `Stringable`
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UserObjectInterface](https://github.com/evansims/openfga-php/blob/main/Models/UserObjectInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------ | ----------- |
| `OPENAPI_MODEL` | `UserObject` | |
#### Methods
##### getId
```php
public function getId(): string
```
Get the unique identifier of the user object. The ID is unique within the context of the object type and represents the specific instance of the typed object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObject.php#L69)
###### Returns
`string` — The object identifier
##### getType
```php
public function getType(): string
```
Get the type of the user object. The type defines the category or class of the object (for example 'user', 'group', 'organization') and must be defined in the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObject.php#L78)
###### Returns
`string` — The object type
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the user object to its JSON representation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObject.php#L87)
###### Returns
`array`
##### schema
*<small>Implements Models\UserObjectInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/UserObject.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UserObjectInterface.md -->
### UserObjectInterface
Represents a user object in OpenFGA authorization model. User objects are typed entities that can be subjects in authorization relationships. They consist of a type (for example 'user', 'group') and a unique identifier within that type.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getId()`](#getid)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObjectInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `Stringable`
- `JsonSerializable`
#### Related Classes
- [UserObject](https://github.com/evansims/openfga-php/blob/main/Models/UserObject.md) (implementation)
#### Methods
##### getId
```php
public function getId(): string
```
Get the unique identifier of the user object. The ID is unique within the context of the object type and represents the specific instance of the typed object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObjectInterface.php#L36)
###### Returns
`string` — The object identifier
##### getType
```php
public function getType(): string
```
Get the type of the user object. The type defines the category or class of the object (for example 'user', 'group', 'organization') and must be defined in the authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObjectInterface.php#L46)
###### Returns
`string` — The object type
##### jsonSerialize
```php
public function jsonSerialize(): array
```
Serialize the user object to its JSON representation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserObjectInterface.php#L54)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/UserObjectInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UserTypeFilter.md -->
### UserTypeFilter
Represents a filter for limiting users by type and optional relation. UserTypeFilter allows you to constrain authorization queries to specific user types, optionally including only users that have a particular relation. This is useful for filtering results when listing users or performing authorization checks on specific user categories. Use this when you need to limit authorization operations to specific types of users in your system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getRelation()`](#getrelation)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilter.php)
#### Implements
- [`UserTypeFilterInterface`](https://github.com/evansims/openfga-php/blob/main/UserTypeFilterInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UserTypeFilterInterface](https://github.com/evansims/openfga-php/blob/main/Models/UserTypeFilterInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ---------------- | ----------- |
| `OPENAPI_MODEL` | `UserTypeFilter` | |
#### Methods
##### getRelation
```php
public function getRelation(): ?string
```
Get the optional relation filter for limiting user types. When specified, this filter limits the results to users that have the specified relation to objects of the target type. This allows for more specific filtering beyond just the object type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilter.php#L56)
###### Returns
`string` | `null`
##### getType
```php
public function getType(): string
```
Get the object type to filter by. This specifies the type of objects that users should be related to when filtering results. Only users connected to objects of this type will be included in the filtered results.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilter.php#L65)
###### Returns
`string` — The object type to filter by
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilter.php#L74)
###### Returns
`array`
##### schema
*<small>Implements Models\UserTypeFilterInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/UserTypeFilter.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UserTypeFilterInterface.md -->
### UserTypeFilterInterface
Represents a filter for limiting users by their relationships to specific object types. User type filters are used in queries to narrow down the set of users based on their relationships to objects of particular types. This is particularly useful when you want to find users who have specific permissions or roles related to certain categories of resources. The filter can specify: - A required object type that users must be related to - An optional relation that further constrains the relationship type Examples: - Find all users related to "document" objects - Find all users who are "viewers" of "folder" objects - Find all users who are "members" of "organization" objects
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getRelation()`](#getrelation)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilterInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [UserTypeFilter](https://github.com/evansims/openfga-php/blob/main/Models/UserTypeFilter.md) (implementation)
#### Methods
##### getRelation
```php
public function getRelation(): ?string
```
Get the optional relation filter for limiting user types. When specified, this filter limits the results to users that have the specified relation to objects of the target type. This allows for more specific filtering beyond just the object type.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilterInterface.php#L39)
###### Returns
`string` | `null`
##### getType
```php
public function getType(): string
```
Get the object type to filter by. This specifies the type of objects that users should be related to when filtering results. Only users connected to objects of this type will be included in the filtered results.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilterInterface.php#L50)
###### Returns
`string` — The object type to filter by
##### jsonSerialize
```php
public function jsonSerialize(): array<'relation'|'type', string>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UserTypeFilterInterface.php#L56)
###### Returns
`array<'relation'` | `'type', string>`
<!-- End of evansims/openfga-php/docs/API/Models/UserTypeFilterInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersListUser.md -->
### UsersListUser
Represents a user entry in a users list response. UsersListUser provides a simple wrapper around user identifiers returned from list operations. It ensures consistent representation of users in lists while providing convenient access to the user identifier string. Use this when working with user lists returned from OpenFGA queries or when you need a structured representation of user identifiers.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getUser()`](#getuser)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersListUser.php)
#### Implements
- [`UsersListUserInterface`](https://github.com/evansims/openfga-php/blob/main/UsersListUserInterface.md)
- `Stringable`
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UsersListUserInterface](https://github.com/evansims/openfga-php/blob/main/Models/UsersListUserInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | --------------- | ----------- |
| `OPENAPI_MODEL` | `UsersListUser` | |
#### Methods
##### getUser
```php
public function getUser(): string
```
Get the user identifier string. This returns the user identifier in the format expected by OpenFGA, typically "type:id" where type describes the kind of user and id is the unique identifier for that user.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersListUser.php#L65)
###### Returns
`string` — The user identifier string
##### jsonSerialize
```php
public function jsonSerialize(): string
```
Serialize the user to its JSON representation. Returns the user identifier as a string for API serialization. This differs from most models which serialize to arrays.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersListUser.php#L74)
###### Returns
`string` — The user identifier string
##### schema
*<small>Implements Models\UsersListUserInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/UsersListUser.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersListUserInterface.md -->
### UsersListUserInterface
Represents a user in a list context for authorization operations. UsersListUser provides a simple wrapper around user identifiers, ensuring they conform to the expected format and can be properly serialized for API operations. This is commonly used in list operations where user identifiers need to be processed in bulk. Use this interface when working with lists of users in authorization contexts, such as batch operations or user enumeration.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getUser()`](#getuser)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersListUserInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `Stringable`
- `JsonSerializable`
#### Related Classes
- [UsersListUser](https://github.com/evansims/openfga-php/blob/main/Models/UsersListUser.md) (implementation)
#### Methods
##### getUser
```php
public function getUser(): string
```
Get the user identifier string. This returns the user identifier in the format expected by OpenFGA, typically "type:id" where type describes the kind of user and id is the unique identifier for that user.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersListUserInterface.php#L42)
###### Returns
`string` — The user identifier string
##### jsonSerialize
```php
public function jsonSerialize(): string
```
Serialize the user to its JSON representation. Returns the user identifier as a string for API serialization. This differs from most models which serialize to arrays.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersListUserInterface.php#L53)
###### Returns
`string` — The user identifier string
<!-- End of evansims/openfga-php/docs/API/Models/UsersListUserInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/Userset.md -->
### Userset
Represents a userset specification for computing groups of users. A Userset defines how to compute a collection of users through various means: computed relationships, tuple-to-userset operations, unions, intersections, or differences. This is a fundamental building block for complex authorization patterns where user groups are derived dynamically. Use this when defining how groups of users should be computed in your authorization model rules.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getComputedUserset()`](#getcomputeduserset)
- [`getDifference()`](#getdifference)
- [`getDirect()`](#getdirect)
- [`getIntersection()`](#getintersection)
- [`getTupleToUserset()`](#gettupletouserset)
- [`getUnion()`](#getunion)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php)
#### Implements
- [`UsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UsersetInterface](https://github.com/evansims/openfga-php/blob/main/Models/UsersetInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | --------- | ----------- |
| `OPENAPI_MODEL` | `Userset` | |
#### Methods
##### getComputedUserset
```php
public function getComputedUserset(): ?OpenFGA\Models\ObjectRelationInterface
```
Get the computed userset specification for this userset. A computed userset defines relationships that are derived from other relationships, allowing for indirect authorization patterns. When present, this specifies an object-relation pair that should be computed to determine the actual users.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php#L70)
###### Returns
[`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/ObjectRelationInterface.md) | `null` — The computed userset specification, or null if not used
##### getDifference
```php
public function getDifference(): ?OpenFGA\Models\DifferenceV1Interface
```
Get the difference operation specification for this userset. A difference operation represents a set subtraction where users are granted access based on one userset but explicitly excluded if they're in another. This enables sophisticated access control patterns like "all managers except those on leave."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php#L79)
###### Returns
[`DifferenceV1Interface`](https://github.com/evansims/openfga-php/blob/main/DifferenceV1Interface.md) | `null` — The difference operation specification, or null if not used
##### getDirect
```php
public function getDirect(): ?object
```
Get the direct userset value for this userset. A direct userset represents an immediate, explicit relationship without complex computation. This is typically used for simple membership patterns where users are directly assigned to a role or permission.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php#L88)
###### Returns
`object` | `null` — The direct userset value, or null if not used
##### getIntersection
```php
public function getIntersection(): ?OpenFGA\Models\Collections\UsersetsInterface
```
Get the intersection operation specification for this userset. An intersection operation represents users who must satisfy ALL of the specified usersets. This creates a logical AND operation where users are granted access only if they're in every userset within the intersection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php#L97)
###### Returns
[`UsersetsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersetsInterface.md) | `null` — The collection of usersets to intersect, or null if not used
##### getTupleToUserset
```php
public function getTupleToUserset(): ?OpenFGA\Models\TupleToUsersetV1Interface
```
Get the tuple-to-userset operation specification for this userset. A tuple-to-userset operation computes users by examining existing relationships and following them to other usersets. This enables complex authorization patterns where permissions are inherited through relationship chains.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php#L106)
###### Returns
[`TupleToUsersetV1Interface`](https://github.com/evansims/openfga-php/blob/main/TupleToUsersetV1Interface.md) | `null` — The tuple-to-userset operation specification, or null if not used
##### getUnion
```php
public function getUnion(): ?OpenFGA\Models\Collections\UsersetsInterface
```
Get the union operation specification for this userset. A union operation represents users who satisfy ANY of the specified usersets. This creates a logical OR operation where users are granted access if they're in at least one userset within the union.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php#L115)
###### Returns
[`UsersetsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersetsInterface.md) | `null` — The collection of usersets to unite, or null if not used
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/Userset.php#L124)
###### Returns
`array`
##### schema
*<small>Implements Models\UsersetInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/Userset.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetInterface.md -->
### UsersetInterface
Defines the contract for userset specifications in authorization models. A userset represents a collection of users that can be computed through various means: direct assignment, computed relationships, unions, intersections, or complex tuple-to-userset operations. This interface provides the foundation for all userset types used in OpenFGA authorization models. Use this when defining how groups of users are identified and computed in your authorization system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getComputedUserset()`](#getcomputeduserset)
- [`getDifference()`](#getdifference)
- [`getDirect()`](#getdirect)
- [`getIntersection()`](#getintersection)
- [`getTupleToUserset()`](#gettupletouserset)
- [`getUnion()`](#getunion)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [Userset](https://github.com/evansims/openfga-php/blob/main/Models/Userset.md) (implementation)
#### Methods
##### getComputedUserset
```php
public function getComputedUserset(): ObjectRelationInterface|null
```
Get the computed userset specification for this userset. A computed userset defines relationships that are derived from other relationships, allowing for indirect authorization patterns. When present, this specifies an object-relation pair that should be computed to determine the actual users.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php#L32)
###### Returns
[`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/ObjectRelationInterface.md) | `null` — The computed userset specification, or null if not used
##### getDifference
```php
public function getDifference(): DifferenceV1Interface|null
```
Get the difference operation specification for this userset. A difference operation represents a set subtraction where users are granted access based on one userset but explicitly excluded if they're in another. This enables sophisticated access control patterns like "all managers except those on leave."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php#L43)
###### Returns
[`DifferenceV1Interface`](https://github.com/evansims/openfga-php/blob/main/DifferenceV1Interface.md) | `null` — The difference operation specification, or null if not used
##### getDirect
```php
public function getDirect(): object|null
```
Get the direct userset value for this userset. A direct userset represents an immediate, explicit relationship without complex computation. This is typically used for simple membership patterns where users are directly assigned to a role or permission.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php#L54)
###### Returns
`object` | `null` — The direct userset value, or null if not used
##### getIntersection
```php
public function getIntersection(): UsersetsInterface|null
```
Get the intersection operation specification for this userset. An intersection operation represents users who must satisfy ALL of the specified usersets. This creates a logical AND operation where users are granted access only if they're in every userset within the intersection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php#L65)
###### Returns
[`UsersetsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersetsInterface.md) | `null` — The collection of usersets to intersect, or null if not used
##### getTupleToUserset
```php
public function getTupleToUserset(): TupleToUsersetV1Interface|null
```
Get the tuple-to-userset operation specification for this userset. A tuple-to-userset operation computes users by examining existing relationships and following them to other usersets. This enables complex authorization patterns where permissions are inherited through relationship chains.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php#L76)
###### Returns
[`TupleToUsersetV1Interface`](https://github.com/evansims/openfga-php/blob/main/TupleToUsersetV1Interface.md) | `null` — The tuple-to-userset operation specification, or null if not used
##### getUnion
```php
public function getUnion(): UsersetsInterface|null
```
Get the union operation specification for this userset. A union operation represents users who satisfy ANY of the specified usersets. This creates a logical OR operation where users are granted access if they're in at least one userset within the union.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php#L87)
###### Returns
[`UsersetsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersetsInterface.md) | `null` — The collection of usersets to unite, or null if not used
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetInterface.php#L100)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/UsersetInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetTree.md -->
### UsersetTree
Represents the evaluation tree for determining user access. When OpenFGA evaluates whether a user has access to an object, it builds a tree structure showing all the authorization paths that were considered. The UsersetTree contains this evaluation tree with a root node that represents the starting point of the access evaluation. This is primarily used for debugging authorization decisions and understanding why access was granted or denied in complex permission scenarios.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getRoot()`](#getroot)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTree.php)
#### Implements
- [`UsersetTreeInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetTreeInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UsersetTreeInterface](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTreeInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------- | ----------- |
| `OPENAPI_MODEL` | `UsersetTree` | |
#### Methods
##### getRoot
```php
public function getRoot(): OpenFGA\Models\NodeInterface
```
Get the root node of the userset tree structure. This returns the top-level node that represents the entry point for userset expansion. The tree structure allows for complex authorization logic including unions, intersections, and difference operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTree.php#L53)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) — The root node of the userset tree
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTree.php#L62)
###### Returns
`array`
##### schema
*<small>Implements Models\UsersetTreeInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/UsersetTree.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetTreeDifference.md -->
### UsersetTreeDifference
Represents a difference operation node in authorization evaluation trees. UsersetTreeDifference computes the difference between two nodes in the authorization evaluation tree, effectively calculating "users in base except those in subtract". This enables complex authorization patterns where access is granted to one group while explicitly excluding another. Use this when working with authorization evaluation trees that involve set difference operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getBase()`](#getbase)
- [`getSubtract()`](#getsubtract)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifference.php)
#### Implements
- [`UsersetTreeDifferenceInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetTreeDifferenceInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UsersetTreeDifferenceInterface](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTreeDifferenceInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------------------ | ----------- |
| `OPENAPI_MODEL` | `UsersetTree.Difference` | |
#### Methods
##### getBase
```php
public function getBase(): OpenFGA\Models\NodeInterface
```
Get the base node from which the subtract node will be removed. This represents the initial node in the userset tree from which users will be subtracted to compute the final difference result.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifference.php#L56)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) — The base node for the difference operation
##### getSubtract
```php
public function getSubtract(): OpenFGA\Models\NodeInterface
```
Get the node representing users to subtract from the base. This represents the node in the userset tree whose users should be removed from the base node to compute the final difference result.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifference.php#L65)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) — The node to subtract from the base
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifference.php#L74)
###### Returns
`array`
##### schema
*<small>Implements Models\UsersetTreeDifferenceInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/UsersetTreeDifference.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetTreeDifferenceInterface.md -->
### UsersetTreeDifferenceInterface
Defines a difference operation node in authorization evaluation trees. UsersetTreeDifference represents a node in the userset evaluation tree that computes the difference between two child nodes, effectively calculating "users in base except those in subtract." This enables authorization patterns where access is granted to one group while explicitly excluding another. Use this interface when working with authorization evaluation trees that contain difference operations, typically returned from expand operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getBase()`](#getbase)
- [`getSubtract()`](#getsubtract)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifferenceInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [UsersetTreeDifference](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTreeDifference.md) (implementation)
#### Methods
##### getBase
```php
public function getBase(): NodeInterface
```
Get the base node from which the subtract node will be removed. This represents the initial node in the userset tree from which users will be subtracted to compute the final difference result.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifferenceInterface.php#L30)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) — The base node for the difference operation
##### getSubtract
```php
public function getSubtract(): NodeInterface
```
Get the node representing users to subtract from the base. This represents the node in the userset tree whose users should be removed from the base node to compute the final difference result.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifferenceInterface.php#L40)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) — The node to subtract from the base
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeDifferenceInterface.php#L46)
###### Returns
`array<`string`, `mixed`>`
<!-- End of evansims/openfga-php/docs/API/Models/UsersetTreeDifferenceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetTreeInterface.md -->
### UsersetTreeInterface
Defines a tree structure for representing complex userset operations. UsersetTree provides a hierarchical representation of authorization evaluation logic, where each node can contain unions, intersections, differences, computed usersets, or tuple-to-userset operations. This tree structure enables OpenFGA to represent and evaluate sophisticated authorization patterns efficiently. Use this interface when working with authorization evaluation trees returned by expand operations or when implementing custom authorization logic that needs to traverse userset structures.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getRoot()`](#getroot)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [UsersetTree](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTree.md) (implementation)
#### Methods
##### getRoot
```php
public function getRoot(): NodeInterface
```
Get the root node of the userset tree structure. This returns the top-level node that represents the entry point for userset expansion. The tree structure allows for complex authorization logic including unions, intersections, and difference operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeInterface.php#L33)
###### Returns
[`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/NodeInterface.md) — The root node of the userset tree
##### jsonSerialize
```php
public function jsonSerialize(): array<string, mixed>
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeInterface.php#L39)
###### Returns
`array<`string`, `mixed`>`
<!-- End of evansims/openfga-php/docs/API/Models/UsersetTreeInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetTreeTupleToUserset.md -->
### UsersetTreeTupleToUserset
Represents a tuple-to-userset operation node in authorization evaluation trees. UsersetTreeTupleToUserset defines how to resolve users through tuple-to-userset mappings during authorization evaluation. It specifies which tuples to examine and how to compute the resulting usersets, enabling complex authorization patterns based on indirect relationships. Use this when working with authorization evaluation trees that involve tuple-to-userset relationship resolution.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getComputed()`](#getcomputed)
- [`getTupleset()`](#gettupleset)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUserset.php)
#### Implements
- [`UsersetTreeTupleToUsersetInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetTreeTupleToUsersetInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UsersetTreeTupleToUsersetInterface](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTreeTupleToUsersetInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ---------------------------- | ----------- |
| `OPENAPI_MODEL` | `UsersetTree.TupleToUserset` | |
#### Methods
##### getComputed
```php
public function getComputed(): array<int, ComputedInterface>
```
Get the array of computed usersets for the tuple-to-userset operation. This returns a collection of computed userset references that define how to resolve the users from the tuple-to-userset mapping in the tree expansion.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUserset.php#L58)
###### Returns
`array<`int`, [`ComputedInterface`](https://github.com/evansims/openfga-php/blob/main/ComputedInterface.md)>` — Array of computed userset references
##### getTupleset
```php
public function getTupleset(): string
```
Get the tupleset string identifying which tuples to use for computation. This string identifies the specific tupleset that should be used to resolve users through the tuple-to-userset operation during tree expansion.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUserset.php#L67)
###### Returns
`string` — The tupleset identifier string
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUserset.php#L76)
###### Returns
`array`
##### schema
*<small>Implements Models\UsersetTreeTupleToUsersetInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/UsersetTreeTupleToUserset.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetTreeTupleToUsersetInterface.md -->
### UsersetTreeTupleToUsersetInterface
Defines a tuple-to-userset operation node in authorization evaluation trees. UsersetTreeTupleToUserset represents a node in the userset evaluation tree that resolves users through tuple-to-userset mappings. This enables complex authorization patterns where access is determined by following relationships from one object to usersets on related objects. Use this interface when working with authorization evaluation trees that contain tuple-to-userset operations, typically returned from expand operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getComputed()`](#getcomputed)
- [`getTupleset()`](#gettupleset)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUsersetInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [UsersetTreeTupleToUserset](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTreeTupleToUserset.md) (implementation)
#### Methods
##### getComputed
```php
public function getComputed(): array<int, ComputedInterface>
```
Get the array of computed usersets for the tuple-to-userset operation. This returns a collection of computed userset references that define how to resolve the users from the tuple-to-userset mapping in the tree expansion.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUsersetInterface.php#L30)
###### Returns
`array<`int`, [`ComputedInterface`](https://github.com/evansims/openfga-php/blob/main/ComputedInterface.md)>` — Array of computed userset references
##### getTupleset
```php
public function getTupleset(): string
```
Get the tupleset string identifying which tuples to use for computation. This string identifies the specific tupleset that should be used to resolve users through the tuple-to-userset operation during tree expansion.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUsersetInterface.php#L40)
###### Returns
`string` — The tupleset identifier string
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetTreeTupleToUsersetInterface.php#L46)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/UsersetTreeTupleToUsersetInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetUser.md -->
### UsersetUser
Represents a user reference through a userset relationship. UsersetUser defines a user specification in the format "object#relation" where users are identified through their relationship to an object rather than direct user identifiers. This enables dynamic user groups based on relationships. Use this when you need to reference users through relationship-based groups rather than explicit user lists.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`getId()`](#getid)
- [`getRelation()`](#getrelation)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUser.php)
#### Implements
- [`UsersetUserInterface`](https://github.com/evansims/openfga-php/blob/main/UsersetUserInterface.md)
- `JsonSerializable`
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
#### Related Classes
- [UsersetUserInterface](https://github.com/evansims/openfga-php/blob/main/Models/UsersetUserInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------------- | ------------- | ----------- |
| `OPENAPI_MODEL` | `UsersetUser` | |
#### Methods
##### getId
```php
public function getId(): string
```
Get the object identifier in the userset reference. This represents the specific object instance that the userset refers to. For example, in "group:eng#member," this would return "eng."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUser.php#L59)
###### Returns
`string` — The object identifier
##### getRelation
```php
public function getRelation(): string
```
Get the relation name in the userset reference. This represents the specific relation on the referenced object that defines the userset. For example, in "group:eng#member," this would return "member."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUser.php#L68)
###### Returns
`string` — The relation name
##### getType
```php
public function getType(): string
```
Get the object type in the userset reference. This represents the type of object that the userset refers to. For example, in "group:eng#member," this would return "group."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUser.php#L77)
###### Returns
`string` — The object type
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUser.php#L86)
###### Returns
`array`
##### schema
*<small>Implements Models\UsersetUserInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/ModelInterface.php#L52)
###### Returns
`SchemaInterface` — The schema definition containing validation rules and property specifications for this model
<!-- End of evansims/openfga-php/docs/API/Models/UsersetUser.md -->
<!-- Source: evansims/openfga-php/docs/API/Models/UsersetUserInterface.md -->
### UsersetUserInterface
Defines the contract for userset user specifications. A userset user represents a reference to users through a userset relationship, typically in the format "object#relation" where object is the entity and relation defines which users are included. This allows dynamic user groups based on relationships rather than static user lists. Use this when you need to reference users through relationship-based groups in your authorization model.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getId()`](#getid)
- [`getRelation()`](#getrelation)
- [`getType()`](#gettype)
- [`jsonSerialize()`](#jsonserialize)
</details>
#### Namespace
`OpenFGA\Models`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUserInterface.php)
#### Implements
- [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/ModelInterface.md)
- `JsonSerializable`
#### Related Classes
- [UsersetUser](https://github.com/evansims/openfga-php/blob/main/Models/UsersetUser.md) (implementation)
#### Methods
##### getId
```php
public function getId(): string
```
Get the object identifier in the userset reference. This represents the specific object instance that the userset refers to. For example, in "group:eng#member," this would return "eng."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUserInterface.php#L30)
###### Returns
`string` — The object identifier
##### getRelation
```php
public function getRelation(): string
```
Get the relation name in the userset reference. This represents the specific relation on the referenced object that defines the userset. For example, in "group:eng#member," this would return "member."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUserInterface.php#L40)
###### Returns
`string` — The relation name
##### getType
```php
public function getType(): string
```
Get the object type in the userset reference. This represents the type of object that the userset refers to. For example, in "group:eng#member," this would return "group."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUserInterface.php#L50)
###### Returns
`string` — The object type
##### jsonSerialize
```php
public function jsonSerialize(): array
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Models/UsersetUserInterface.php#L56)
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Models/UsersetUserInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/BatchRequestProcessor.md -->
### BatchRequestProcessor
Handles batch processing of write tuple requests. This class encapsulates the logic for processing write tuple requests in both transactional and non-transactional modes. It handles chunking, parallel execution, retries, and error aggregation.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`getLastRequest()`](#getlastrequest)
- [`getLastResponse()`](#getlastresponse)
- [`process()`](#process)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/BatchRequestProcessor.php)
#### Methods
##### getLastRequest
```php
public function getLastRequest(): ?Psr\Http\Message\RequestInterface
```
Get the last HTTP request made.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/BatchRequestProcessor.php#L42)
###### Returns
`Psr\Http\Message\RequestInterface` | `null`
##### getLastResponse
```php
public function getLastResponse(): ?Psr\Http\Message\ResponseInterface
```
Get the last HTTP response received.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/BatchRequestProcessor.php#L50)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null`
##### process
```php
public function process(WriteTuplesRequest $request): SuccessInterface
```
Process a write tuples request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/BatchRequestProcessor.php#L64)
###### Parameters
| Name | Type | Description |
| ---------- | ------------------------------------------------------ | ---------------------- |
| `$request` | [`WriteTuplesRequest`](https://github.com/evansims/openfga-php/blob/main/Requests/WriteTuplesRequest.md) | The request to process |
###### Returns
[`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Always returns Success with WriteTuplesResponse
<!-- End of evansims/openfga-php/docs/API/Network/BatchRequestProcessor.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/CircuitBreaker.md -->
### CircuitBreaker
Circuit breaker implementation for preventing cascade failures in distributed systems. This class implements the circuit breaker pattern to temporarily disable requests to failing endpoints, preventing resource exhaustion and allowing time for recovery. The circuit breaker tracks failures per endpoint and automatically opens/closes based on failure thresholds and cooldown periods. The circuit breaker operates in three states: - Closed: Normal operation, requests are allowed - Open: Failures exceeded threshold, requests are blocked - Half-Open: After cooldown, limited requests allowed to test recovery
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getFailureCount()`](#getfailurecount)
- [`isOpen()`](#isopen)
- [`recordFailure()`](#recordfailure)
- [`recordSuccess()`](#recordsuccess)
- [`shouldRetry()`](#shouldretry)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreaker.php)
#### Implements
- [`CircuitBreakerInterface`](https://github.com/evansims/openfga-php/blob/main/CircuitBreakerInterface.md)
#### Related Classes
- [CircuitBreakerInterface](https://github.com/evansims/openfga-php/blob/main/Network/CircuitBreakerInterface.md) (interface)
#### Methods
##### getFailureCount
```php
public function getFailureCount(string $endpoint): int
```
Get the current failure count for an endpoint. Returns the number of consecutive failures recorded for the specified endpoint. This can be useful for logging and monitoring purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreaker.php#L54)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier to check |
###### Returns
`int` — The current failure count (0 if no failures recorded)
##### isOpen
```php
public function isOpen(string $endpoint): bool
```
Check if the circuit is currently open for an endpoint. Returns true if the circuit breaker is currently blocking requests to the specified endpoint due to excessive failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreaker.php#L65)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier to check |
###### Returns
`bool` — True if the circuit is open (blocking requests), false otherwise
##### recordFailure
```php
public function recordFailure(string $endpoint): void
```
Record a failure for the specified endpoint. Increments the failure count for the endpoint and updates the failure timestamp. If the failure threshold is reached, the circuit will open and block subsequent requests until the cooldown period expires.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreaker.php#L74)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------------ |
| `$endpoint` | `string` | The endpoint URL or identifier that failed |
###### Returns
`void`
##### recordSuccess
```php
public function recordSuccess(string $endpoint): void
```
Record a successful request for the specified endpoint. Resets the failure state for the endpoint, effectively closing the circuit and allowing normal operation to resume. This should be called whenever a request succeeds after previous failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreaker.php#L85)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier that succeeded |
###### Returns
`void`
##### shouldRetry
```php
public function shouldRetry(string $endpoint): bool
```
Check if the circuit breaker should allow a request to the specified endpoint. Evaluates whether a request should be allowed based on the current circuit state for the given endpoint. If the cooldown period has passed, the circuit is automatically reset to allow new attempts.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreaker.php#L95)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier to check |
###### Returns
`bool` — True if requests should be allowed, false if the circuit is open
<!-- End of evansims/openfga-php/docs/API/Network/CircuitBreaker.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/CircuitBreakerInterface.md -->
### CircuitBreakerInterface
Circuit breaker interface for preventing cascade failures in distributed systems. This interface defines the contract for circuit breaker implementations that temporarily disable requests to failing endpoints, preventing resource exhaustion and allowing time for recovery. Circuit breakers track failures per endpoint and automatically open/close based on failure thresholds and cooldown periods. The circuit breaker operates in three states: - Closed: Normal operation, requests are allowed - Open: Failures exceeded threshold, requests are blocked - Half-Open: After cooldown, limited requests allowed to test recovery
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getFailureCount()`](#getfailurecount)
- [`isOpen()`](#isopen)
- [`recordFailure()`](#recordfailure)
- [`recordSuccess()`](#recordsuccess)
- [`shouldRetry()`](#shouldretry)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreakerInterface.php)
#### Related Classes
- [CircuitBreaker](https://github.com/evansims/openfga-php/blob/main/Network/CircuitBreaker.md) (implementation)
#### Methods
##### getFailureCount
```php
public function getFailureCount(string $endpoint): int
```
Get the current failure count for an endpoint. Returns the number of consecutive failures recorded for the specified endpoint. This can be useful for logging and monitoring purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreakerInterface.php#L34)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier to check |
###### Returns
`int` — The current failure count (0 if no failures recorded)
##### isOpen
```php
public function isOpen(string $endpoint): bool
```
Check if the circuit is currently open for an endpoint. Returns true if the circuit breaker is currently blocking requests to the specified endpoint due to excessive failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreakerInterface.php#L45)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier to check |
###### Returns
`bool` — True if the circuit is open (blocking requests), false otherwise
##### recordFailure
```php
public function recordFailure(string $endpoint): void
```
Record a failure for the specified endpoint. Increments the failure count for the endpoint and updates the failure timestamp. If the failure threshold is reached, the circuit will open and block subsequent requests until the cooldown period expires.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreakerInterface.php#L56)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------------ |
| `$endpoint` | `string` | The endpoint URL or identifier that failed |
###### Returns
`void`
##### recordSuccess
```php
public function recordSuccess(string $endpoint): void
```
Record a successful request for the specified endpoint. Resets the failure state for the endpoint, effectively closing the circuit and allowing normal operation to resume. This should be called whenever a request succeeds after previous failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreakerInterface.php#L67)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier that succeeded |
###### Returns
`void`
##### shouldRetry
```php
public function shouldRetry(string $endpoint): bool
```
Check if the circuit breaker should allow a request to the specified endpoint. Evaluates whether a request should be allowed based on the current circuit state for the given endpoint. If the cooldown period has passed, the circuit is automatically reset to allow new attempts.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/CircuitBreakerInterface.php#L79)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | --------------------------------------- |
| `$endpoint` | `string` | The endpoint URL or identifier to check |
###### Returns
`bool` — True if requests should be allowed, false if the circuit is open
<!-- End of evansims/openfga-php/docs/API/Network/CircuitBreakerInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/ConcurrentExecutorInterface.md -->
### ConcurrentExecutorInterface
Interface for concurrent task execution. This interface defines the contract for executing multiple tasks concurrently, providing improved performance for batch operations. Implementations can use different concurrency strategies such as Fibers, threads, or process pools.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`executeParallel()`](#executeparallel)
- [`getMaxRecommendedConcurrency()`](#getmaxrecommendedconcurrency)
- [`supportsConcurrency()`](#supportsconcurrency)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/ConcurrentExecutorInterface.php)
#### Methods
##### executeParallel
```php
public function executeParallel(
array<int, callable(): T> $tasks,
int $maxConcurrent = 10,
bool $stopOnFirstError = false,
): array<int, T|Throwable>
```
Execute multiple tasks in parallel. Executes the provided tasks concurrently up to the specified concurrency limit. Tasks are executed as they become available and results are collected in the same order as the input tasks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/ConcurrentExecutorInterface.php#L36)
###### Parameters
| Name | Type | Description |
| ------------------- | ------------------------------------- | ---------------------------------------------- |
| `$tasks` | `array<`int`, `callable(): T`>` | |
| `$maxConcurrent` | `int` | Maximum number of concurrent executions |
| `$stopOnFirstError` | `bool` | Stop all tasks when first error is encountered |
###### Returns
`array<int, T` | `Throwable>` — Array of results or exceptions in the same order as tasks
##### getMaxRecommendedConcurrency
```php
public function getMaxRecommendedConcurrency(): int
```
Get the maximum recommended concurrency for the current environment. This provides a hint about the optimal concurrency level based on system resources and implementation constraints.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/ConcurrentExecutorInterface.php#L46)
###### Returns
`int` — Maximum recommended concurrent tasks
##### supportsConcurrency
```php
public function supportsConcurrency(): bool
```
Check if the executor supports concurrent execution. Some environments may not support true concurrency (for example missing Fiber support in PHP < 8.1). This method allows checking if the executor can actually run tasks concurrently or will fall back to sequential execution.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/ConcurrentExecutorInterface.php#L58)
###### Returns
`bool` — True if concurrent execution is supported
<!-- End of evansims/openfga-php/docs/API/Network/ConcurrentExecutorInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/ExponentialBackoffRetryStrategy.md -->
### ExponentialBackoffRetryStrategy
Exponential backoff retry strategy implementation. This strategy implements exponential backoff with jitter for retrying failed operations. It increases the delay between retries exponentially to reduce load on the server during failure scenarios, while adding random jitter to prevent thundering herd problems.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`execute()`](#execute)
- [`getRetryDelay()`](#getretrydelay)
- [`isRetryable()`](#isretryable)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/ExponentialBackoffRetryStrategy.php)
#### Implements
- [`RetryStrategyInterface`](https://github.com/evansims/openfga-php/blob/main/RetryStrategyInterface.md)
#### Methods
##### execute
```php
public function execute(callable $operation, array $config = []): mixed
```
Execute an operation with retry logic. Executes the given operation and retries it according to the strategy's implementation if it fails. The strategy determines when to retry, how long to wait between retries, and when to give up.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/ExponentialBackoffRetryStrategy.php#L65)
###### Parameters
| Name | Type | Description |
| ------------ | ---------- | ----------- |
| `$operation` | `callable` | |
| `$config` | `array` | |
###### Returns
`mixed` — The result of the successful operation
##### getRetryDelay
```php
public function getRetryDelay(int $attempt, array $config = []): int
```
Get the delay before the next retry attempt.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/ExponentialBackoffRetryStrategy.php#L98)
###### Parameters
| Name | Type | Description |
| ---------- | ------- | ------------------------------------ |
| `$attempt` | `int` | The current attempt number (1-based) |
| `$config` | `array` | |
###### Returns
`int` — The delay in milliseconds
##### isRetryable
```php
public function isRetryable(Throwable $exception): bool
```
Determine if an exception is retryable.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/ExponentialBackoffRetryStrategy.php#L125)
###### Parameters
| Name | Type | Description |
| ------------ | ----------- | ---------------------- |
| `$exception` | `Throwable` | The exception to check |
###### Returns
`bool` — True if the operation should be retried, false otherwise
<!-- End of evansims/openfga-php/docs/API/Network/ExponentialBackoffRetryStrategy.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/FiberConcurrentExecutor.md -->
### FiberConcurrentExecutor
Fiber-based concurrent executor implementation. This implementation uses PHP 8.1+ Fibers to execute tasks concurrently without the overhead of threads or processes. Fibers provide cooperative multitasking, allowing efficient concurrent execution of I/O-bound tasks such as HTTP requests.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`executeParallel()`](#executeparallel)
- [`getMaxRecommendedConcurrency()`](#getmaxrecommendedconcurrency)
- [`supportsConcurrency()`](#supportsconcurrency)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/FiberConcurrentExecutor.php)
#### Implements
- [`ConcurrentExecutorInterface`](https://github.com/evansims/openfga-php/blob/main/ConcurrentExecutorInterface.md)
#### Methods
##### executeParallel
```php
public function executeParallel(array $tasks, int $maxConcurrent = 10, bool $stopOnFirstError = false): array
```
Execute multiple tasks in parallel. Executes the provided tasks concurrently up to the specified concurrency limit. Tasks are executed as they become available and results are collected in the same order as the input tasks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/FiberConcurrentExecutor.php#L33)
###### Parameters
| Name | Type | Description |
| ------------------- | ------- | ---------------------------------------------- |
| `$tasks` | `array` | |
| `$maxConcurrent` | `int` | Maximum number of concurrent executions |
| `$stopOnFirstError` | `bool` | Stop all tasks when first error is encountered |
###### Returns
`array` — Array of results or exceptions in the same order as tasks
##### getMaxRecommendedConcurrency
```php
public function getMaxRecommendedConcurrency(): int
```
Get the maximum recommended concurrency for the current environment. This provides a hint about the optimal concurrency level based on system resources and implementation constraints.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/FiberConcurrentExecutor.php#L91)
###### Returns
`int` — Maximum recommended concurrent tasks
##### supportsConcurrency
```php
public function supportsConcurrency(): bool
```
Check if the executor supports concurrent execution. Some environments may not support true concurrency (for example missing Fiber support in PHP < 8.1). This method allows checking if the executor can actually run tasks concurrently or will fall back to sequential execution.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/FiberConcurrentExecutor.php#L102)
###### Returns
`bool` — True if concurrent execution is supported
<!-- End of evansims/openfga-php/docs/API/Network/FiberConcurrentExecutor.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/HttpClientInterface.md -->
### HttpClientInterface
HTTP client interface for sending HTTP requests. This interface abstracts the HTTP client implementation, allowing different HTTP clients to be used interchangeably. It follows the PSR-18 HTTP Client standard for compatibility.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`send()`](#send)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/HttpClientInterface.php)
#### Methods
##### send
```php
public function send(RequestInterface $request): ResponseInterface
```
Send an HTTP request and return the response.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/HttpClientInterface.php#L28)
###### Parameters
| Name | Type | Description |
| ---------- | -------------------------------------------------- | ------------------------ |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The HTTP request to send |
###### Returns
[`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) — The HTTP response
<!-- End of evansims/openfga-php/docs/API/Network/HttpClientInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/ParallelTaskExecutor.md -->
### ParallelTaskExecutor
Executes tasks in parallel using the RequestManager infrastructure. This class provides a clean abstraction for parallel task execution, leveraging the existing Fiber-based implementation in RequestManager.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`execute()`](#execute)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/ParallelTaskExecutor.php)
#### Methods
##### execute
```php
public function execute(
array<callable(): (FailureInterface|SuccessInterface)> $tasks,
int $maxParallelRequests,
bool $stopOnFirstError,
): array<FailureInterface|SuccessInterface>
```
Execute tasks with specified parallelism.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/ParallelTaskExecutor.php#L34)
###### Parameters
| Name | Type | Description |
| ---------------------- | ----------------------------------------------------------------------- | ------------------------------ |
| `$tasks` | `array<callable(): (FailureInterface` | `SuccessInterface)>` | |
| `$maxParallelRequests` | `int` | Maximum concurrent requests |
| `$stopOnFirstError` | `bool` | Whether to stop on first error |
###### Returns
`array<FailureInterface` | `SuccessInterface>` — Results from each task
<!-- End of evansims/openfga-php/docs/API/Network/ParallelTaskExecutor.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/PsrHttpClient.md -->
### PsrHttpClient
PSR-18 compliant HTTP client implementation. This implementation wraps any PSR-18 compatible HTTP client, providing automatic discovery if no client is provided. It ensures compatibility with various HTTP client libraries while maintaining a consistent interface for the OpenFGA SDK.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`send()`](#send)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/PsrHttpClient.php)
#### Implements
- [`HttpClientInterface`](https://github.com/evansims/openfga-php/blob/main/HttpClientInterface.md)
#### Methods
##### send
```php
public function send(Psr\Http\Message\RequestInterface $request): Psr\Http\Message\ResponseInterface
```
Send an HTTP request and return the response.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/PsrHttpClient.php#L44)
###### Parameters
| Name | Type | Description |
| ---------- | ----------------------------------- | ------------------------ |
| `$request` | `Psr\Http\Message\RequestInterface` | The HTTP request to send |
###### Returns
`Psr\Http\Message\ResponseInterface` — The HTTP response
<!-- End of evansims/openfga-php/docs/API/Network/PsrHttpClient.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/README.md -->
## Network
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Network
HTTP client abstractions, retry strategies, and low-level networking components.
**Total Components:** 19
### Interfaces
| Name | Description |
|------|-------------|
| [`CircuitBreakerInterface`](https://github.com/evansims/openfga-php/blob/main/./CircuitBreakerInterface.md) | Circuit breaker interface for preventing cascade failures in distributed systems. This interface ... |
| [`ConcurrentExecutorInterface`](https://github.com/evansims/openfga-php/blob/main/./ConcurrentExecutorInterface.md) | Interface for concurrent task execution. This interface defines the contract for executing multip... |
| [`HttpClientInterface`](https://github.com/evansims/openfga-php/blob/main/./HttpClientInterface.md) | HTTP client interface for sending HTTP requests. This interface abstracts the HTTP client impleme... |
| [`RequestContextInterface`](https://github.com/evansims/openfga-php/blob/main/./RequestContextInterface.md) | Represents the context for an HTTP request to the OpenFGA API. This interface encapsulates all th... |
| [`RequestManagerInterface`](https://github.com/evansims/openfga-php/blob/main/./RequestManagerInterface.md) | Manages HTTP requests and responses for OpenFGA API communication. This interface defines the cor... |
| [`RetryHandlerInterface`](https://github.com/evansims/openfga-php/blob/main/./RetryHandlerInterface.md) | Retry handler interface for advanced HTTP request retry strategies. This interface defines the co... |
| [`RetryStrategyInterface`](https://github.com/evansims/openfga-php/blob/main/./RetryStrategyInterface.md) | Interface for implementing retry strategies. This interface defines the contract for different re... |
### Classes
| Name | Description |
|------|-------------|
| [`BatchRequestProcessor`](https://github.com/evansims/openfga-php/blob/main/./BatchRequestProcessor.md) | Handles batch processing of write tuple requests. This class encapsulates the logic for processin... |
| [`CircuitBreaker`](https://github.com/evansims/openfga-php/blob/main/./CircuitBreaker.md) | Circuit breaker implementation for preventing cascade failures in distributed systems. This class... |
| [`ExponentialBackoffRetryStrategy`](https://github.com/evansims/openfga-php/blob/main/./ExponentialBackoffRetryStrategy.md) | Exponential backoff retry strategy implementation. This strategy implements exponential backoff w... |
| [`FiberConcurrentExecutor`](https://github.com/evansims/openfga-php/blob/main/./FiberConcurrentExecutor.md) | Fiber-based concurrent executor implementation. This implementation uses PHP 8.1+ Fibers to execu... |
| [`ParallelTaskExecutor`](https://github.com/evansims/openfga-php/blob/main/./ParallelTaskExecutor.md) | Executes tasks in parallel using the RequestManager infrastructure. This class provides a clean a... |
| [`PsrHttpClient`](https://github.com/evansims/openfga-php/blob/main/./PsrHttpClient.md) | PSR-18 compliant HTTP client implementation. This implementation wraps any PSR-18 compatible HTTP... |
| [`RequestContext`](https://github.com/evansims/openfga-php/blob/main/./RequestContext.md) | Implementation of request context for OpenFGA API operations. This class provides a concrete impl... |
| [`RequestManager`](https://github.com/evansims/openfga-php/blob/main/./RequestManager.md) | Concrete implementation of HTTP request management for OpenFGA API communication. This class prov... |
| [`RequestManagerFactory`](https://github.com/evansims/openfga-php/blob/main/./RequestManagerFactory.md) | Factory for creating RequestManager instances. This factory encapsulates the creation of RequestM... |
| [`RetryHandler`](https://github.com/evansims/openfga-php/blob/main/./RetryHandler.md) | Concrete implementation of the retry handler using standard sleep delays. This final class provid... |
| [`SimpleConcurrentExecutor`](https://github.com/evansims/openfga-php/blob/main/./SimpleConcurrentExecutor.md) | Simple concurrent executor implementation. This implementation provides a fallback for environmen... |
### Enumerations
| Name | Description |
|------|-------------|
| [`RequestMethod`](https://github.com/evansims/openfga-php/blob/main/./RequestMethod.md) | HTTP request methods supported by the OpenFGA API. This enum defines the specific HTTP methods us... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Network/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RequestContext.md -->
### RequestContext
Implementation of request context for OpenFGA API operations. This class provides a concrete implementation of the RequestContextInterface, encapsulating all the information needed to construct and execute HTTP requests to the OpenFGA API. It stores request metadata including HTTP method, URL, headers, body content, and routing configuration in an immutable structure. The RequestContext serves as a data transfer object that carries request information from the high-level API operations down to the HTTP transport layer, ensuring that all necessary context is preserved throughout the request processing pipeline.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getBody()`](#getbody)
- [`getHeaders()`](#getheaders)
- [`getMethod()`](#getmethod)
- [`getUrl()`](#geturl)
- [`useApiUrl()`](#useapiurl)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContext.php)
#### Implements
- [`RequestContextInterface`](https://github.com/evansims/openfga-php/blob/main/RequestContextInterface.md)
#### Related Classes
- [RequestContextInterface](https://github.com/evansims/openfga-php/blob/main/Network/RequestContextInterface.md) (interface)
#### Methods
##### getBody
```php
public function getBody(): ?Psr\Http\Message\StreamInterface
```
Get the request body stream. Returns the PSR-7 stream containing the request body data for operations that require sending data to the OpenFGA API. The body typically contains JSON-encoded request parameters for operations like writing relationships, creating authorization models, or checking permissions. Operations that only retrieve data (such as reading relationships or listing stores) typically have no body content and will return null.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContext.php#L54)
###### Returns
`Psr\Http\Message\StreamInterface` | `null` — The request body stream containing JSON data, or null for operations without body content
##### getHeaders
```php
public function getHeaders(): array
```
Get the request headers. Returns an associative array of HTTP headers that should be included with the request. This typically includes content-type headers, authentication headers, and any custom headers required for specific API operations. Headers are merged with default headers provided by the RequestManager, with context-specific headers taking precedence over defaults. Common headers include Content-Type for JSON requests and Authorization for API authentication.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContext.php#L63)
###### Returns
`array` — Associative array mapping header names to their values
##### getMethod
```php
public function getMethod(): OpenFGA\Network\RequestMethod
```
Get the HTTP method for the request. Returns the HTTP method that should be used for this API operation. Different OpenFGA operations use different HTTP methods based on their semantic meaning: - GET for reading data (listing stores, reading relationships) - POST for creating or querying (authorization checks, writing relationships) - PUT for updating existing resources - DELETE for removing resources
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContext.php#L72)
###### Returns
[`RequestMethod`](https://github.com/evansims/openfga-php/blob/main/RequestMethod.md) — The HTTP method enum value indicating the request type
##### getUrl
```php
public function getUrl(): string
```
Get the URL for the request. Returns the target URL path for this API operation. This is typically a relative path that gets combined with the base API URL to form the complete request URL. For example, "/stores" for listing stores or "/stores/{store_id}/check" for authorization checks. The URL may contain path parameters that have been resolved with actual values (like store IDs or model IDs) before being included in the context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContext.php#L81)
###### Returns
`string` — The target URL path for the API operation
##### useApiUrl
```php
public function useApiUrl(): bool
```
Determine if the API URL should be used as a prefix. Controls whether the base API URL should be prepended to the request URL. Most OpenFGA API operations use the standard API base URL, but some operations (like health checks or custom endpoints) might use alternative base URLs or absolute URLs. When true, the RequestManager will prepend the configured API base URL to the request URL. When false, the URL is used as-is, allowing for complete URL override when necessary.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContext.php#L90)
###### Returns
`bool` — True if the API base URL should be prepended to the request URL, false to use the URL as-is
<!-- End of evansims/openfga-php/docs/API/Network/RequestContext.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RequestContextInterface.md -->
### RequestContextInterface
Represents the context for an HTTP request to the OpenFGA API. This interface encapsulates all the essential components needed to construct and execute HTTP requests to the OpenFGA service. It provides a structured way to manage request metadata including HTTP method, target URL, request body, headers, and routing configurations that determine how the request is processed. The request context serves as an abstraction layer between the high-level OpenFGA operations (like authorization checks, relationship writes, etc.) and the low-level HTTP communication details. This separation enables: - Consistent request formatting across different API operations - Centralized management of authentication and headers - Flexible URL routing and API endpoint resolution - Testable and mockable HTTP communication layer Request contexts are typically created by the OpenFGA client during API operations and passed to the RequestManager for actual HTTP execution. The context includes both required elements (method, URL) and optional elements (body, custom headers) that may vary depending on the specific API operation being performed.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getBody()`](#getbody)
- [`getHeaders()`](#getheaders)
- [`getMethod()`](#getmethod)
- [`getUrl()`](#geturl)
- [`useApiUrl()`](#useapiurl)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContextInterface.php)
#### Related Classes
- [RequestContext](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) (implementation)
#### Methods
##### getBody
```php
public function getBody(): StreamInterface|null
```
Get the request body stream. Returns the PSR-7 stream containing the request body data for operations that require sending data to the OpenFGA API. The body typically contains JSON-encoded request parameters for operations like writing relationships, creating authorization models, or checking permissions. Operations that only retrieve data (such as reading relationships or listing stores) typically have no body content and will return null.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContextInterface.php#L49)
###### Returns
`StreamInterface` | `null` — The request body stream containing JSON data, or null for operations without body content
##### getHeaders
```php
public function getHeaders(): array<string, string>
```
Get the request headers. Returns an associative array of HTTP headers that should be included with the request. This typically includes content-type headers, authentication headers, and any custom headers required for specific API operations. Headers are merged with default headers provided by the RequestManager, with context-specific headers taking precedence over defaults. Common headers include Content-Type for JSON requests and Authorization for API authentication.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContextInterface.php#L65)
###### Returns
`array<`string`, `string`>` — Associative array mapping header names to their values
##### getMethod
```php
public function getMethod(): RequestMethod
```
Get the HTTP method for the request. Returns the HTTP method that should be used for this API operation. Different OpenFGA operations use different HTTP methods based on their semantic meaning: - GET for reading data (listing stores, reading relationships) - POST for creating or querying (authorization checks, writing relationships) - PUT for updating existing resources - DELETE for removing resources
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContextInterface.php#L80)
###### Returns
[`RequestMethod`](https://github.com/evansims/openfga-php/blob/main/RequestMethod.md) — The HTTP method enum value indicating the request type
##### getUrl
```php
public function getUrl(): string
```
Get the URL for the request. Returns the target URL path for this API operation. This is typically a relative path that gets combined with the base API URL to form the complete request URL. For example, "/stores" for listing stores or "/stores/{store_id}/check" for authorization checks. The URL may contain path parameters that have been resolved with actual values (like store IDs or model IDs) before being included in the context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContextInterface.php#L95)
###### Returns
`string` — The target URL path for the API operation
##### useApiUrl
```php
public function useApiUrl(): bool
```
Determine if the API URL should be used as a prefix. Controls whether the base API URL should be prepended to the request URL. Most OpenFGA API operations use the standard API base URL, but some operations (like health checks or custom endpoints) might use alternative base URLs or absolute URLs. When true, the RequestManager will prepend the configured API base URL to the request URL. When false, the URL is used as-is, allowing for complete URL override when necessary.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestContextInterface.php#L111)
###### Returns
`bool` — True if the API base URL should be prepended to the request URL, false to use the URL as-is
<!-- End of evansims/openfga-php/docs/API/Network/RequestContextInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RequestManager.md -->
### RequestManager
Concrete implementation of HTTP request management for OpenFGA API communication. This class provides the core HTTP communication layer for the OpenFGA SDK, handling all aspects of request construction, execution, and response processing. It integrates with PSR-7 HTTP message interfaces and PSR-18 HTTP clients to provide a flexible, testable HTTP transport layer. The RequestManager manages: - PSR-17 factory auto-discovery and configuration - HTTP client configuration and request execution - Authentication header management - Request URL construction and routing - Error response parsing and exception handling - User-Agent header management for SDK identification The implementation uses lazy initialization for PSR components, automatically discovering suitable implementations when not explicitly provided. This ensures compatibility with a wide range of HTTP libraries while maintaining optimal performance.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`executeParallel()`](#executeparallel)
- [`getHttpClient()`](#gethttpclient)
- [`getHttpRequestFactory()`](#gethttprequestfactory)
- [`getHttpResponseFactory()`](#gethttpresponsefactory)
- [`getHttpStreamFactory()`](#gethttpstreamfactory)
- [`handleResponseException()`](#handleresponseexception)
- [`request()`](#request)
- [`send()`](#send)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php)
#### Implements
- [`RequestManagerInterface`](https://github.com/evansims/openfga-php/blob/main/RequestManagerInterface.md)
#### Related Classes
- [RequestManagerInterface](https://github.com/evansims/openfga-php/blob/main/Network/RequestManagerInterface.md) (interface)
#### Methods
##### executeParallel
```php
public function executeParallel(
array<callable(): (FailureInterface|SuccessInterface)> $tasks,
int $maxParallelRequests,
bool $stopOnFirstError,
): array<FailureInterface|SuccessInterface>
```
Execute multiple tasks concurrently using Fibers. This method creates and manages Fibers for concurrent execution of the provided tasks. It respects the maximum parallelism limit and efficiently schedules fiber execution to maximize throughput.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php#L160)
###### Parameters
| Name | Type | Description |
| ---------------------- | ----------------------------------------------------------------------- | ------------------------------ |
| `$tasks` | `array<callable(): (FailureInterface` | `SuccessInterface)>` | |
| `$maxParallelRequests` | `int` | Maximum concurrent requests |
| `$stopOnFirstError` | `bool` | Whether to stop on first error |
###### Returns
`array<FailureInterface` | `SuccessInterface>` — Results from all tasks in the same order as input
##### getHttpClient
```php
public function getHttpClient(): Psr\Http\Client\ClientInterface
```
Get the configured PSR-18 HTTP client. Returns the HTTP client instance used for executing requests to the OpenFGA API. The client handles the actual network communication and can be any PSR-18 compatible implementation such as Guzzle, cURL, or others. If no client was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery. The HTTP client is responsible for network-level concerns including connection management, SSL/TLS handling, timeout enforcement, and low-level HTTP protocol implementation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php#L192)
###### Returns
`ClientInterface` — The PSR-18 HTTP client instance for executing requests
##### getHttpRequestFactory
```php
public function getHttpRequestFactory(): Psr\Http\Message\RequestFactoryInterface
```
Get the configured PSR-17 HTTP request factory. Returns the factory used for creating PSR-7 HTTP request objects. This factory is used to construct HTTP requests from OpenFGA request contexts, including setting the appropriate method, URI, headers, and body content. If no factory was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php#L226)
###### Returns
`RequestFactoryInterface` — The PSR-17 factory for creating HTTP request objects
##### getHttpResponseFactory
```php
public function getHttpResponseFactory(): Psr\Http\Message\ResponseFactoryInterface
```
Get the configured PSR-17 HTTP response factory. Returns the factory used for creating PSR-7 HTTP response objects. This is primarily used for testing and mocking scenarios where custom responses need to be constructed programmatically. If no factory was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php#L260)
###### Returns
`ResponseFactoryInterface` — The PSR-17 factory for creating HTTP response objects
##### getHttpStreamFactory
```php
public function getHttpStreamFactory(): Psr\Http\Message\StreamFactoryInterface
```
Get the configured PSR-17 HTTP stream factory. Returns the factory used for creating PSR-7 stream objects for HTTP message bodies. This factory is used to convert request data (such as JSON payloads) into stream objects that can be attached to HTTP requests. If no factory was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php#L294)
###### Returns
`StreamFactoryInterface` — The PSR-17 factory for creating HTTP message body streams
##### handleResponseException
*<small>Implements Network\RequestManagerInterface</small>*
```php
public function handleResponseException(ResponseInterface $response, HttpRequestInterface|null $request = NULL): never
```
Handle error responses by throwing appropriate exceptions. Analyzes HTTP error responses to determine the specific type of error and throws the most appropriate exception with comprehensive context information. This method processes: - HTTP status codes (400, 401, 403, 404, 409, 422, 500, etc.) - Error response bodies containing detailed error information - OpenFGA-specific error codes and messages - Request context for debugging purposes The method provides structured error information that applications can use for error handling, user messaging, and debugging. Different exception types are thrown based on the error category to enable appropriate handling strategies. Common error scenarios include: - 400 Bad Request: Invalid request parameters or malformed data - 401 Unauthorized: Missing or invalid authentication credentials - 403 Forbidden: Valid credentials but insufficient permissions - 404 Not Found: Requested resource (store, model) does not exist - 409 Conflict: Request conflicts with current resource state - 422 Unprocessable Entity: Request timeout or processing limits exceeded - 500 Internal Server Error: Server-side processing failures
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php#L77)
###### Parameters
| Name | Type | Description |
| ----------- | ----------------------------------------------------- | -------------------------------------------------------------- |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | The HTTP error response to analyze and convert to an exception |
| `$request` | `HttpRequestInterface` | `null` | Optional request context for enhanced error reporting |
###### Returns
`never` — This method always throws an exception and never returns normally
##### request
```php
public function request(OpenFGA\Requests\RequestInterface $request): Psr\Http\Message\RequestInterface
```
Convert an OpenFGA request into a PSR-7 HTTP request. Transforms high-level OpenFGA API requests into standardized PSR-7 HTTP requests that can be executed by any PSR-18 compliant HTTP client. This process includes: - Building the complete request URL from the base API URL and endpoint path - Setting appropriate HTTP method based on the operation type - Adding authentication headers using configured credentials - Serializing request data to JSON and creating appropriate body streams - Setting required headers (Content-Type, User-Agent, etc.) The conversion process ensures that all OpenFGA API requirements are met, including proper content negotiation, authentication, and request formatting according to the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php#L328)
###### Parameters
| Name | Type | Description |
| ---------- | -------------------------------------------------- | --------------------------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The high-level OpenFGA API request to convert |
###### Returns
`Psr\Http\Message\RequestInterface` — The PSR-7 HTTP request ready for execution
##### send
```php
public function send(Psr\Http\Message\RequestInterface $request): Psr\Http\Message\ResponseInterface
```
Send an HTTP request and return the response. Executes the provided PSR-7 HTTP request using the configured HTTP client with comprehensive error handling and retry logic. This method handles: - Network-level errors (connection failures, timeouts, DNS issues) - HTTP-level errors (4xx and 5xx status codes) - Automatic retry logic for transient failures - Response validation and error context extraction The method provides detailed error information for debugging, including request/response details, error codes, and suggested remediation steps when requests fail. Successful responses are returned as-is for further processing by the calling code.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManager.php#L381)
###### Parameters
| Name | Type | Description |
| ---------- | ----------------------------------- | --------------------------------- |
| `$request` | `Psr\Http\Message\RequestInterface` | The PSR-7 HTTP request to execute |
###### Returns
`Psr\Http\Message\ResponseInterface` — The HTTP response from the OpenFGA API
<!-- End of evansims/openfga-php/docs/API/Network/RequestManager.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RequestManagerFactory.md -->
### RequestManagerFactory
Factory for creating RequestManager instances. This factory encapsulates the creation of RequestManager instances with the appropriate configuration for different use cases (normal requests vs batch operations).
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`create()`](#create)
- [`createForBatch()`](#createforbatch)
- [`createWithRetries()`](#createwithretries)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerFactory.php)
#### Methods
##### create
```php
public function create(): RequestManager
```
Create a RequestManager for normal operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerFactory.php#L55)
###### Returns
[`RequestManager`](https://github.com/evansims/openfga-php/blob/main/RequestManager.md) — A RequestManager configured with default retry settings
##### createForBatch
```php
public function createForBatch(): RequestManager
```
Create a RequestManager for batch operations (no HTTP retries).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerFactory.php#L77)
###### Returns
[`RequestManager`](https://github.com/evansims/openfga-php/blob/main/RequestManager.md) — A RequestManager configured with retries disabled
##### createWithRetries
```php
public function createWithRetries(int $maxRetries): RequestManager
```
Create a RequestManager with custom retry configuration.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerFactory.php#L101)
###### Parameters
| Name | Type | Description |
| ------------- | ----- | -------------------------------- |
| `$maxRetries` | `int` | Maximum number of retry attempts |
###### Returns
[`RequestManager`](https://github.com/evansims/openfga-php/blob/main/RequestManager.md) — A RequestManager configured with the specified retry limit
<!-- End of evansims/openfga-php/docs/API/Network/RequestManagerFactory.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RequestManagerInterface.md -->
### RequestManagerInterface
Manages HTTP requests and responses for OpenFGA API communication. This interface defines the core HTTP communication layer for the OpenFGA SDK, responsible for translating high-level API operations into HTTP requests and processing the responses. It handles all aspects of HTTP communication including request construction, authentication, error handling, and response processing. The RequestManager serves as the bridge between the OpenFGA client's domain-specific operations and the underlying HTTP transport layer. It abstracts away the complexities of HTTP communication while providing a clean, testable interface for API interactions. Key responsibilities include: - Converting OpenFGA requests to PSR-7 HTTP requests - Managing HTTP client configuration and PSR component integration - Handling authentication headers and API credentials - Executing HTTP requests with retry logic and timeout management - Processing HTTP responses and converting errors to appropriate exceptions - Providing comprehensive error context for debugging and monitoring The implementation uses PSR-7 HTTP message interfaces for maximum compatibility with existing PHP HTTP ecosystems and follows PSR-18 HTTP client standards for pluggable HTTP transport implementations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getHttpClient()`](#gethttpclient)
- [`getHttpRequestFactory()`](#gethttprequestfactory)
- [`getHttpResponseFactory()`](#gethttpresponsefactory)
- [`getHttpStreamFactory()`](#gethttpstreamfactory)
- [`request()`](#request)
- [`send()`](#send)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php)
#### Related Classes
- [RequestManager](https://github.com/evansims/openfga-php/blob/main/Network/RequestManager.md) (implementation)
#### Methods
##### getHttpClient
```php
public function getHttpClient(): ClientInterface
```
Get the configured PSR-18 HTTP client. Returns the HTTP client instance used for executing requests to the OpenFGA API. The client handles the actual network communication and can be any PSR-18 compatible implementation such as Guzzle, cURL, or others. If no client was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery. The HTTP client is responsible for network-level concerns including connection management, SSL/TLS handling, timeout enforcement, and low-level HTTP protocol implementation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php#L96)
###### Returns
[`ClientInterface`](https://github.com/evansims/openfga-php/blob/main/ClientInterface.md) — The PSR-18 HTTP client instance for executing requests
##### getHttpRequestFactory
```php
public function getHttpRequestFactory(): RequestFactoryInterface
```
Get the configured PSR-17 HTTP request factory. Returns the factory used for creating PSR-7 HTTP request objects. This factory is used to construct HTTP requests from OpenFGA request contexts, including setting the appropriate method, URI, headers, and body content. If no factory was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php#L112)
###### Returns
`RequestFactoryInterface` — The PSR-17 factory for creating HTTP request objects
##### getHttpResponseFactory
```php
public function getHttpResponseFactory(): ResponseFactoryInterface
```
Get the configured PSR-17 HTTP response factory. Returns the factory used for creating PSR-7 HTTP response objects. This is primarily used for testing and mocking scenarios where custom responses need to be constructed programmatically. If no factory was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php#L128)
###### Returns
`ResponseFactoryInterface` — The PSR-17 factory for creating HTTP response objects
##### getHttpStreamFactory
```php
public function getHttpStreamFactory(): StreamFactoryInterface
```
Get the configured PSR-17 HTTP stream factory. Returns the factory used for creating PSR-7 stream objects for HTTP message bodies. This factory is used to convert request data (such as JSON payloads) into stream objects that can be attached to HTTP requests. If no factory was explicitly provided during construction, the RequestManager will attempt to discover one automatically using PSR Discovery.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php#L144)
###### Returns
`StreamFactoryInterface` — The PSR-17 factory for creating HTTP message body streams
##### request
```php
public function request(RequestInterface $request): HttpRequestInterface
```
Convert an OpenFGA request into a PSR-7 HTTP request. Transforms high-level OpenFGA API requests into standardized PSR-7 HTTP requests that can be executed by any PSR-18 compliant HTTP client. This process includes: - Building the complete request URL from the base API URL and endpoint path - Setting appropriate HTTP method based on the operation type - Adding authentication headers using configured credentials - Serializing request data to JSON and creating appropriate body streams - Setting required headers (Content-Type, User-Agent, etc.) The conversion process ensures that all OpenFGA API requirements are met, including proper content negotiation, authentication, and request formatting according to the OpenFGA API specification.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php#L169)
###### Parameters
| Name | Type | Description |
| ---------- | -------------------------------------------------- | --------------------------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The high-level OpenFGA API request to convert |
###### Returns
`HttpRequestInterface` — The PSR-7 HTTP request ready for execution
##### send
```php
public function send(HttpRequestInterface $request): ResponseInterface
```
Send an HTTP request and return the response. Executes the provided PSR-7 HTTP request using the configured HTTP client with comprehensive error handling and retry logic. This method handles: - Network-level errors (connection failures, timeouts, DNS issues) - HTTP-level errors (4xx and 5xx status codes) - Automatic retry logic for transient failures - Response validation and error context extraction The method provides detailed error information for debugging, including request/response details, error codes, and suggested remediation steps when requests fail. Successful responses are returned as-is for further processing by the calling code.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestManagerInterface.php#L192)
###### Parameters
| Name | Type | Description |
| ---------- | ---------------------- | --------------------------------- |
| `$request` | `HttpRequestInterface` | The PSR-7 HTTP request to execute |
###### Returns
[`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) — The HTTP response from the OpenFGA API
<!-- End of evansims/openfga-php/docs/API/Network/RequestManagerInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RequestMethod.md -->
### RequestMethod
HTTP request methods supported by the OpenFGA API. This enum defines the specific HTTP methods used for communicating with the OpenFGA service, following standard HTTP semantics for different types of operations. Each method corresponds to specific types of API operations based on their intended semantic meaning and expected behavior. The OpenFGA API uses different HTTP methods to indicate the nature of the operation being performed, following RESTful principles: - GET for retrieving data without side effects - POST for creating resources or performing operations with side effects - PUT for updating or replacing existing resources - DELETE for removing resources from the system Using the appropriate HTTP method ensures proper caching behavior, idempotency characteristics, and compatibility with HTTP infrastructure components like proxies, load balancers, and CDNs.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`hasRequestBody()`](#hasrequestbody)
- [`isIdempotent()`](#isidempotent)
- [`isSafe()`](#issafe)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestMethod.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `DELETE` | `DELETE` | DELETE method for removing resources. Used for operations that remove resources from the OpenFGA system, such as deleting stores, removing relationship tuples, or clearing authorization data. DELETE operations are idempotent, meaning that multiple identical requests have the same effect as a single request. Common OpenFGA operations using DELETE: - Deleting authorization stores - Removing relationship tuples - Clearing assertion data |
| `GET` | `GET` | GET method for retrieving data. Used for operations that retrieve information from the OpenFGA system without causing any side effects or state changes. GET requests are safe and idempotent, making them suitable for caching and repeated execution without concern for unintended consequences. Common OpenFGA operations using GET: - Listing authorization stores - Reading relationship tuples - Retrieving authorization models - Fetching store metadata |
| `POST` | `POST` | POST method for creating resources and performing operations. Used for operations that create new resources or perform actions that may have side effects on the OpenFGA system. POST requests are neither safe nor idempotent, as each request may create new resources or trigger different system behaviors. Common OpenFGA operations using POST: - Performing authorization checks - Writing relationship tuples - Creating authorization models - Creating new stores - Expanding relationship queries |
| `PUT` | `PUT` | PUT method for updating or replacing resources. Used for operations that update existing resources or create resources with client-specified identifiers. PUT requests are idempotent, meaning that multiple identical requests result in the same final system state. Common OpenFGA operations using PUT: - Updating store metadata - Replacing authorization model configurations - Updating assertion data |
#### Cases
| Name | Value | Description |
| -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `DELETE` | `DELETE` | DELETE method for removing resources. Used for operations that remove resources from the OpenFGA system, such as deleting stores, removing relationship tuples, or clearing authorization data. DELETE operations are idempotent, meaning that multiple identical requests have the same effect as a single request. Common OpenFGA operations using DELETE: - Deleting authorization stores - Removing relationship tuples - Clearing assertion data |
| `GET` | `GET` | GET method for retrieving data. Used for operations that retrieve information from the OpenFGA system without causing any side effects or state changes. GET requests are safe and idempotent, making them suitable for caching and repeated execution without concern for unintended consequences. Common OpenFGA operations using GET: - Listing authorization stores - Reading relationship tuples - Retrieving authorization models - Fetching store metadata |
| `POST` | `POST` | POST method for creating resources and performing operations. Used for operations that create new resources or perform actions that may have side effects on the OpenFGA system. POST requests are neither safe nor idempotent, as each request may create new resources or trigger different system behaviors. Common OpenFGA operations using POST: - Performing authorization checks - Writing relationship tuples - Creating authorization models - Creating new stores - Expanding relationship queries |
| `PUT` | `PUT` | PUT method for updating or replacing resources. Used for operations that update existing resources or create resources with client-specified identifiers. PUT requests are idempotent, meaning that multiple identical requests result in the same final system state. Common OpenFGA operations using PUT: - Updating store metadata - Replacing authorization model configurations - Updating assertion data |
#### Methods
##### hasRequestBody
```php
public function hasRequestBody(): bool
```
Check if this HTTP method typically expects a request body. Useful for client implementations to determine whether to include request body serialization and content-type headers.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestMethod.php#L101)
###### Returns
`bool` — True if the method typically has a request body, false otherwise
##### isIdempotent
```php
public function isIdempotent(): bool
```
Check if this HTTP method is idempotent. Idempotent methods can be called multiple times with the same effect. This is useful for retry logic and caching decisions in HTTP clients.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestMethod.php#L117)
###### Returns
`bool` — True if the method is idempotent, false otherwise
##### isSafe
```php
public function isSafe(): bool
```
Check if this HTTP method is safe. Safe methods do not modify server state and can be cached. This is important for HTTP middleware and caching strategies.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RequestMethod.php#L133)
###### Returns
`bool` — True if the method is safe, false otherwise
<!-- End of evansims/openfga-php/docs/API/Network/RequestMethod.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RetryHandler.md -->
### RetryHandler
Concrete implementation of the retry handler using standard sleep delays. This final class provides the default implementation of the retry handler that uses actual sleep delays for production use. For testing or custom delay implementations, extend AbstractRetryHandler instead.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`executeWithRetry()`](#executewithretry)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RetryHandler.php)
#### Implements
- [`RetryHandlerInterface`](https://github.com/evansims/openfga-php/blob/main/RetryHandlerInterface.md)
#### Related Classes
- [RetryHandlerInterface](https://github.com/evansims/openfga-php/blob/main/Network/RetryHandlerInterface.md) (interface)
#### Methods
##### executeWithRetry
```php
public function executeWithRetry(
callable $requestExecutor,
Psr\Http\Message\RequestInterface $request,
string $endpoint,
): Psr\Http\Message\ResponseInterface
```
Execute an HTTP request with automatic retry logic. Performs the HTTP request with intelligent retry behavior based on error type, server headers, and circuit breaker state. The method tracks attempt counts, calculates appropriate delays, and respects server-provided timing information. The implementation should: - Check circuit breaker state before attempting requests - Apply exponential backoff with jitter to prevent thundering herd - Respect server-provided timing headers (Retry-After, X-Rate-Limit-Reset) - Handle different error types with appropriate retry strategies - Consider request method idempotency for retry decisions - Track failures and successes with the circuit breaker
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/AbstractRetryHandler.php#L104)
###### Parameters
| Name | Type | Description |
| ------------------ | ----------------------------------- | --------------------------------------------- |
| `$requestExecutor` | `callable` | |
| `$request` | `Psr\Http\Message\RequestInterface` | The original HTTP request for context |
| `$endpoint` | `string` | The endpoint URL for circuit breaker tracking |
###### Returns
`Psr\Http\Message\ResponseInterface` — The successful HTTP response
<!-- End of evansims/openfga-php/docs/API/Network/RetryHandler.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RetryHandlerInterface.md -->
### RetryHandlerInterface
Retry handler interface for advanced HTTP request retry strategies. This interface defines the contract for retry handler implementations that provide sophisticated retry logic for HTTP requests, including exponential backoff, jitter, circuit breaker integration, and server-header-aware delays. Retry handlers categorize errors and apply appropriate retry strategies: - Network errors: Fast initial retry with exponential backoff - Rate limits (429): Honor server timing headers exactly - Server errors (5xx): Standard exponential backoff - Maintenance (503): Extended delays for service recovery The implementation should respect server-provided timing via Retry-After and rate limit headers while providing fallback logic for cases where such headers are unavailable.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`executeWithRetry()`](#executewithretry)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RetryHandlerInterface.php)
#### Related Classes
- [RetryHandler](https://github.com/evansims/openfga-php/blob/main/Network/RetryHandler.md) (implementation)
#### Methods
##### executeWithRetry
```php
public function executeWithRetry(
callable $requestExecutor,
RequestInterface $request,
string $endpoint,
): ResponseInterface
```
Execute an HTTP request with automatic retry logic. Performs the HTTP request with intelligent retry behavior based on error type, server headers, and circuit breaker state. The method tracks attempt counts, calculates appropriate delays, and respects server-provided timing information. The implementation should: - Check circuit breaker state before attempting requests - Apply exponential backoff with jitter to prevent thundering herd - Respect server-provided timing headers (Retry-After, X-Rate-Limit-Reset) - Handle different error types with appropriate retry strategies - Consider request method idempotency for retry decisions - Track failures and successes with the circuit breaker
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RetryHandlerInterface.php#L55)
###### Parameters
| Name | Type | Description |
| ------------------ | -------------------------------------------------- | --------------------------------------------- |
| `$requestExecutor` | `callable` | |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The original HTTP request for context |
| `$endpoint` | `string` | The endpoint URL for circuit breaker tracking |
###### Returns
[`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) — The successful HTTP response
<!-- End of evansims/openfga-php/docs/API/Network/RetryHandlerInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/RetryStrategyInterface.md -->
### RetryStrategyInterface
Interface for implementing retry strategies. This interface defines the contract for different retry strategies that can be used when operations fail. Implementations can provide various retry algorithms such as exponential backoff, linear retry, or custom strategies based on specific requirements.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`execute()`](#execute)
- [`getRetryDelay()`](#getretrydelay)
- [`isRetryable()`](#isretryable)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/RetryStrategyInterface.php)
#### Methods
##### execute
```php
public function execute(callable $operation, array<string, mixed> $config = []): T
```
Execute an operation with retry logic. Executes the given operation and retries it according to the strategy's implementation if it fails. The strategy determines when to retry, how long to wait between retries, and when to give up.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RetryStrategyInterface.php#L36)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------------- | ----------- |
| `$operation` | `callable` | |
| `$config` | `array<`string`, `mixed`>` | |
###### Returns
`T` — The result of the successful operation
##### getRetryDelay
```php
public function getRetryDelay(int $attempt, array<string, mixed> $config = []): int
```
Get the delay before the next retry attempt.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RetryStrategyInterface.php#L45)
###### Parameters
| Name | Type | Description |
| ---------- | -------------------------------- | ------------------------------------ |
| `$attempt` | `int` | The current attempt number (1-based) |
| `$config` | `array<`string`, `mixed`>` | |
###### Returns
`int` — The delay in milliseconds
##### isRetryable
```php
public function isRetryable(Throwable $exception): bool
```
Determine if an exception is retryable.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/RetryStrategyInterface.php#L53)
###### Parameters
| Name | Type | Description |
| ------------ | ----------- | ---------------------- |
| `$exception` | `Throwable` | The exception to check |
###### Returns
`bool` — True if the operation should be retried, false otherwise
<!-- End of evansims/openfga-php/docs/API/Network/RetryStrategyInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Network/SimpleConcurrentExecutor.md -->
### SimpleConcurrentExecutor
Simple concurrent executor implementation. This implementation provides a fallback for environments without Fiber support. It executes tasks sequentially while maintaining the same interface as the fiber-based implementation.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`executeParallel()`](#executeparallel)
- [`getMaxRecommendedConcurrency()`](#getmaxrecommendedconcurrency)
- [`supportsConcurrency()`](#supportsconcurrency)
</details>
#### Namespace
`OpenFGA\Network`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Network/SimpleConcurrentExecutor.php)
#### Implements
- [`ConcurrentExecutorInterface`](https://github.com/evansims/openfga-php/blob/main/ConcurrentExecutorInterface.md)
#### Methods
##### executeParallel
```php
public function executeParallel(array $tasks, int $maxConcurrent = 10, bool $stopOnFirstError = false): array
```
Execute multiple tasks in parallel. Executes the provided tasks concurrently up to the specified concurrency limit. Tasks are executed as they become available and results are collected in the same order as the input tasks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/SimpleConcurrentExecutor.php#L24)
###### Parameters
| Name | Type | Description |
| ------------------- | ------- | ---------------------------------------------- |
| `$tasks` | `array` | |
| `$maxConcurrent` | `int` | Maximum number of concurrent executions |
| `$stopOnFirstError` | `bool` | Stop all tasks when first error is encountered |
###### Returns
`array` — Array of results or exceptions in the same order as tasks
##### getMaxRecommendedConcurrency
```php
public function getMaxRecommendedConcurrency(): int
```
Get the maximum recommended concurrency for the current environment. This provides a hint about the optimal concurrency level based on system resources and implementation constraints.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/SimpleConcurrentExecutor.php#L52)
###### Returns
`int` — Maximum recommended concurrent tasks
##### supportsConcurrency
```php
public function supportsConcurrency(): bool
```
Check if the executor supports concurrent execution. Some environments may not support true concurrency (for example missing Fiber support in PHP < 8.1). This method allows checking if the executor can actually run tasks concurrently or will fall back to sequential execution.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Network/SimpleConcurrentExecutor.php#L61)
###### Returns
`bool` — True if concurrent execution is supported
<!-- End of evansims/openfga-php/docs/API/Network/SimpleConcurrentExecutor.md -->
<!-- Source: evansims/openfga-php/docs/API/Observability/OpenTelemetryProvider.md -->
### OpenTelemetryProvider
OpenTelemetry implementation for OpenFGA SDK observability. This class provides comprehensive telemetry capabilities for the OpenFGA SDK using OpenTelemetry APIs. It creates structured traces for all operations, records performance metrics, and tracks reliability indicators such as retry attempts and circuit breaker state changes. The implementation follows OpenTelemetry semantic conventions for HTTP clients and RPC operations, ensuring compatibility with standard observability tools and platforms. All telemetry is optional and gracefully degrades when OpenTelemetry is not configured.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`endHttpRequest()`](#endhttprequest)
- [`endOperation()`](#endoperation)
- [`recordAuthenticationEvent()`](#recordauthenticationevent)
- [`recordCircuitBreakerState()`](#recordcircuitbreakerstate)
- [`recordOperationMetrics()`](#recordoperationmetrics)
- [`recordRetryAttempt()`](#recordretryattempt)
- [`recordSpan()`](#recordspan)
- [`startHttpRequest()`](#starthttprequest)
- [`startOperation()`](#startoperation)
</details>
#### Namespace
`OpenFGA\Observability`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php)
#### Implements
- [`TelemetryInterface`](https://github.com/evansims/openfga-php/blob/main/TelemetryInterface.md)
#### Methods
##### endHttpRequest
```php
public function endHttpRequest(
?object $span,
?Psr\Http\Message\ResponseInterface $response = NULL,
?Throwable $exception = NULL,
): void
```
End tracing for an HTTP request. Completes the HTTP request span, recording the response status and any errors that occurred. The span should include standard HTTP response attributes such as status code and response size.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L151)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------------------------------- | --------------------------------------------------- |
| `$span` | `object` | `null` | The span identifier returned by startHttpRequest() |
| `$response` | `Psr\Http\Message\ResponseInterface` | `null` | The HTTP response received, if any |
| `$exception` | `Throwable` | `null` | Optional exception that occurred during the request |
###### Returns
`void`
##### endOperation
```php
public function endOperation(
?object $span,
bool $success,
?Throwable $exception = NULL,
array $attributes = [],
): void
```
End tracing for an OpenFGA API operation. Completes the trace span started with startOperation(), recording the operation outcome and any relevant metrics. If an exception occurred during the operation, it should be recorded in the span.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L225)
###### Parameters
| Name | Type | Description |
| ------------- | ------------------------- | ----------------------------------------------------- |
| `$span` | `object` | `null` | The span identifier returned by startOperation() |
| `$success` | `bool` | Whether the operation completed successfully |
| `$exception` | `Throwable` | `null` | Optional exception that occurred during the operation |
| `$attributes` | `array` | |
###### Returns
`void`
##### recordAuthenticationEvent
```php
public function recordAuthenticationEvent(
string $event,
bool $success,
float $duration,
array $attributes = [],
): void
```
Record authentication events. Records metrics and traces related to authentication flows, including token acquisition, refresh operations, and authentication failures. This helps monitor authentication performance and troubleshoot auth issues.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L299)
###### Parameters
| Name | Type | Description |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------- |
| `$event` | `string` | The authentication event type ('token_request', 'token_refresh', 'auth_failure') |
| `$success` | `bool` | Whether the authentication event was successful |
| `$duration` | `float` | The duration of the authentication operation in seconds |
| `$attributes` | `array` | |
###### Returns
`void`
##### recordCircuitBreakerState
```php
public function recordCircuitBreakerState(
string $endpoint,
string $state,
int $failures,
float $failureRate,
): void
```
Record circuit breaker state changes. Records metrics about circuit breaker state transitions and failure rates. This helps monitor the health of individual API endpoints and the SDK's resilience mechanisms.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L337)
###### Parameters
| Name | Type | Description |
| -------------- | -------- | ------------------------------------------------------------------------------------------- |
| `$endpoint` | `string` | The API endpoint this circuit breaker protects |
| `$state` | `string` | The new circuit breaker state ('open', 'closed', 'half_open') |
| `$failures` | `int` | The current failure count |
| `$failureRate` | `float` | The current failure rate (0.0 to 1.0) |
###### Returns
`void`
##### recordOperationMetrics
```php
public function recordOperationMetrics(
string $operation,
float $duration,
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
array $attributes = [],
): void
```
Record performance metrics for OpenFGA operations. Records timing and throughput metrics for OpenFGA API operations, allowing monitoring of operation latency and identifying performance bottlenecks or degradations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L378)
###### Parameters
| Name | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------- |
| `$operation` | `string` | The OpenFGA operation name |
| `$duration` | `float` | The operation duration in seconds |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store being operated on |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | The authorization model used |
| `$attributes` | `array` | |
###### Returns
`void`
##### recordRetryAttempt
```php
public function recordRetryAttempt(
string $endpoint,
int $attempt,
int $delayMs,
string $outcome,
?Throwable $exception = NULL,
): void
```
Record retry attempt metrics. Records metrics about retry attempts, including the retry count, delay, and eventual outcome. This helps track the reliability and performance of API requests under various network conditions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L413)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------- | ----------------------------------------------------------------------------------------- |
| `$endpoint` | `string` | The API endpoint being retried |
| `$attempt` | `int` | The current attempt number (1-based) |
| `$delayMs` | `int` | The delay before this attempt in milliseconds |
| `$outcome` | `string` | The outcome of this attempt ('success', 'failure', 'retry') |
| `$exception` | `Throwable` | `null` | Optional exception from this attempt |
###### Returns
`void`
##### recordSpan
```php
public function recordSpan(string $name, array $attributes = []): void
```
Record a telemetry span with attributes. Records a complete telemetry span for events that don't require start/end semantics. This is useful for event-driven telemetry where the event represents a point in time rather than a duration.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L462)
###### Parameters
| Name | Type | Description |
| ------------- | -------- | ------------- |
| `$name` | `string` | The span name |
| `$attributes` | `array` | |
###### Returns
`void`
##### startHttpRequest
```php
public function startHttpRequest(Psr\Http\Message\RequestInterface $request): object
```
Start tracing an HTTP request. Creates a new trace span for an outgoing HTTP request to the OpenFGA API. The span should follow OpenTelemetry semantic conventions for HTTP client operations, including standard HTTP attributes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L484)
###### Parameters
| Name | Type | Description |
| ---------- | ----------------------------------- | --------------------------- |
| `$request` | `Psr\Http\Message\RequestInterface` | The HTTP request being sent |
###### Returns
`object` — A span identifier or context that can be passed to endHttpRequest()
##### startOperation
```php
public function startOperation(
string $operation,
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
array $attributes = [],
): object
```
Start tracing an OpenFGA API operation. Creates a new trace span for a high-level OpenFGA operation such as check, expand, or write operations. The span should include relevant attributes such as store ID, authorization model ID, and operation-specific metadata.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/OpenTelemetryProvider.php#L522)
###### Parameters
| Name | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| `$operation` | `string` | The OpenFGA operation name (for example 'check', 'expand', 'write_tuples') |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store being operated on |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | The authorization model being used |
| `$attributes` | `array` | |
###### Returns
`object` — A span identifier or context that can be passed to endOperation()
<!-- End of evansims/openfga-php/docs/API/Observability/OpenTelemetryProvider.md -->
<!-- Source: evansims/openfga-php/docs/API/Observability/README.md -->
## Observability
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Observability
Telemetry providers and monitoring integrations for operational visibility.
**Total Components:** 5
### Interfaces
| Name | Description |
|------|-------------|
| [`TelemetryEventListenerInterface`](https://github.com/evansims/openfga-php/blob/main/./TelemetryEventListenerInterface.md) | Interface for event listeners that forward domain events to telemetry providers. This interface d... |
| [`TelemetryInterface`](https://github.com/evansims/openfga-php/blob/main/./TelemetryInterface.md) | Interface for OpenTelemetry integration in the OpenFGA SDK. This interface provides methods for i... |
### Classes
| Name | Description |
|------|-------------|
| [`OpenTelemetryProvider`](https://github.com/evansims/openfga-php/blob/main/./OpenTelemetryProvider.md) | OpenTelemetry implementation for OpenFGA SDK observability. This class provides comprehensive tel... |
| [`TelemetryEventListener`](https://github.com/evansims/openfga-php/blob/main/./TelemetryEventListener.md) | Event listener that forwards domain events to the telemetry provider. This decouples business log... |
| [`TelemetryFactory`](https://github.com/evansims/openfga-php/blob/main/./TelemetryFactory.md) | Factory for creating telemetry providers with OpenTelemetry integration. This factory provides co... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Observability/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Observability/TelemetryEventListener.md -->
### TelemetryEventListener
Event listener that forwards domain events to the telemetry provider. This decouples business logic from telemetry by using events to communicate what happened without the business logic needing to know about telemetry.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`onHttpRequestSent()`](#onhttprequestsent)
- [`onHttpResponseReceived()`](#onhttpresponsereceived)
- [`onOperationCompleted()`](#onoperationcompleted)
- [`onOperationStarted()`](#onoperationstarted)
</details>
#### Namespace
`OpenFGA\Observability`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListener.php)
#### Implements
- [`TelemetryEventListenerInterface`](https://github.com/evansims/openfga-php/blob/main/TelemetryEventListenerInterface.md)
#### Related Classes
- [TelemetryEventListenerInterface](https://github.com/evansims/openfga-php/blob/main/Observability/TelemetryEventListenerInterface.md) (interface)
#### Methods
##### onHttpRequestSent
```php
public function onHttpRequestSent(OpenFGA\Events\HttpRequestSentEvent $event): void
```
Handle HTTP request sent events. Records telemetry data when an HTTP request is sent, including request method, URL, body size, and OpenFGA-specific context like operation, store ID, and model ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListener.php#L29)
###### Parameters
| Name | Type | Description |
| -------- | -------------------------------------------------------- | --------------------------- |
| `$event` | [`HttpRequestSentEvent`](https://github.com/evansims/openfga-php/blob/main/Events/HttpRequestSentEvent.md) | The HTTP request sent event |
###### Returns
`void`
##### onHttpResponseReceived
```php
public function onHttpResponseReceived(OpenFGA\Events\HttpResponseReceivedEvent $event): void
```
Handle HTTP response received events. Records telemetry data when an HTTP response is received, including response status, body size, and any exception information if the request failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListener.php#L46)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------------ | -------------------------------- |
| `$event` | [`HttpResponseReceivedEvent`](https://github.com/evansims/openfga-php/blob/main/Events/HttpResponseReceivedEvent.md) | The HTTP response received event |
###### Returns
`void`
##### onOperationCompleted
```php
public function onOperationCompleted(OpenFGA\Events\OperationCompletedEvent $event): void
```
Handle operation completed events. Records telemetry data when an OpenFGA operation completes, including success status, operation context, and exception details if the operation failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListener.php#L72)
###### Parameters
| Name | Type | Description |
| -------- | -------------------------------------------------------------- | ----------------------------- |
| `$event` | [`OperationCompletedEvent`](https://github.com/evansims/openfga-php/blob/main/Events/OperationCompletedEvent.md) | The operation completed event |
###### Returns
`void`
##### onOperationStarted
```php
public function onOperationStarted(OpenFGA\Events\OperationStartedEvent $event): void
```
Handle operation started events. Records telemetry data when an OpenFGA operation begins, including operation type, store context, and model information.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListener.php#L94)
###### Parameters
| Name | Type | Description |
| -------- | ---------------------------------------------------------- | --------------------------- |
| `$event` | [`OperationStartedEvent`](https://github.com/evansims/openfga-php/blob/main/Events/OperationStartedEvent.md) | The operation started event |
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Observability/TelemetryEventListener.md -->
<!-- Source: evansims/openfga-php/docs/API/Observability/TelemetryEventListenerInterface.md -->
### TelemetryEventListenerInterface
Interface for event listeners that forward domain events to telemetry providers. This interface defines the contract for handling telemetry-related events throughout the OpenFGA client lifecycle, enabling observability without tightly coupling business logic to telemetry concerns.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`onHttpRequestSent()`](#onhttprequestsent)
- [`onHttpResponseReceived()`](#onhttpresponsereceived)
- [`onOperationCompleted()`](#onoperationcompleted)
- [`onOperationStarted()`](#onoperationstarted)
</details>
#### Namespace
`OpenFGA\Observability`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListenerInterface.php)
#### Related Classes
- [TelemetryEventListener](https://github.com/evansims/openfga-php/blob/main/Observability/TelemetryEventListener.md) (implementation)
#### Methods
##### onHttpRequestSent
```php
public function onHttpRequestSent(HttpRequestSentEvent $event): void
```
Handle HTTP request sent events. Records telemetry data when an HTTP request is sent, including request method, URL, body size, and OpenFGA-specific context like operation, store ID, and model ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListenerInterface.php#L27)
###### Parameters
| Name | Type | Description |
| -------- | ---------------------- | --------------------------- |
| `$event` | `HttpRequestSentEvent` | The HTTP request sent event |
###### Returns
`void`
##### onHttpResponseReceived
```php
public function onHttpResponseReceived(HttpResponseReceivedEvent $event): void
```
Handle HTTP response received events. Records telemetry data when an HTTP response is received, including response status, body size, and any exception information if the request failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListenerInterface.php#L38)
###### Parameters
| Name | Type | Description |
| -------- | --------------------------- | -------------------------------- |
| `$event` | `HttpResponseReceivedEvent` | The HTTP response received event |
###### Returns
`void`
##### onOperationCompleted
```php
public function onOperationCompleted(OperationCompletedEvent $event): void
```
Handle operation completed events. Records telemetry data when an OpenFGA operation completes, including success status, operation context, and exception details if the operation failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListenerInterface.php#L49)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------- | ----------------------------- |
| `$event` | `OperationCompletedEvent` | The operation completed event |
###### Returns
`void`
##### onOperationStarted
```php
public function onOperationStarted(OperationStartedEvent $event): void
```
Handle operation started events. Records telemetry data when an OpenFGA operation begins, including operation type, store context, and model information.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryEventListenerInterface.php#L59)
###### Parameters
| Name | Type | Description |
| -------- | ----------------------- | --------------------------- |
| `$event` | `OperationStartedEvent` | The operation started event |
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Observability/TelemetryEventListenerInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Observability/TelemetryFactory.md -->
### TelemetryFactory
Factory for creating telemetry providers with OpenTelemetry integration. This factory provides convenient methods for setting up observability with the OpenFGA SDK. It handles the conditional creation of OpenTelemetry providers when the dependencies are available, and falls back to null when they are not. The factory follows the principle of graceful degradation, ensuring that the SDK remains functional even when OpenTelemetry is not installed or configured in the host application.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
</details>
#### Namespace
`OpenFGA\Observability`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryFactory.php)
<!-- End of evansims/openfga-php/docs/API/Observability/TelemetryFactory.md -->
<!-- Source: evansims/openfga-php/docs/API/Observability/TelemetryInterface.md -->
### TelemetryInterface
Interface for OpenTelemetry integration in the OpenFGA SDK. This interface provides methods for instrumenting OpenFGA operations with observability features including distributed tracing, metrics collection, and structured logging. Implementations should integrate with OpenTelemetry or other observability platforms to provide insights into SDK performance and operation outcomes. The interface supports both automatic instrumentation of HTTP requests and business-level instrumentation of OpenFGA API operations. All methods are designed to be safe to call even when no telemetry backend is configured, ensuring the SDK remains functional without observability dependencies.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`endHttpRequest()`](#endhttprequest)
- [`endOperation()`](#endoperation)
- [`recordAuthenticationEvent()`](#recordauthenticationevent)
- [`recordCircuitBreakerState()`](#recordcircuitbreakerstate)
- [`recordOperationMetrics()`](#recordoperationmetrics)
- [`recordRetryAttempt()`](#recordretryattempt)
- [`recordSpan()`](#recordspan)
- [`startHttpRequest()`](#starthttprequest)
- [`startOperation()`](#startoperation)
</details>
#### Namespace
`OpenFGA\Observability`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php)
#### Methods
##### endHttpRequest
```php
public function endHttpRequest(
object|null $span,
ResponseInterface|null $response = NULL,
Throwable|null $exception = NULL,
): void
```
End tracing for an HTTP request. Completes the HTTP request span, recording the response status and any errors that occurred. The span should include standard HTTP response attributes such as status code and response size.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L41)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------------------------------------------------- | --------------------------------------------------- |
| `$span` | `object` | `null` | The span identifier returned by startHttpRequest() |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` | The HTTP response received, if any |
| `$exception` | `Throwable` | `null` | Optional exception that occurred during the request |
###### Returns
`void`
##### endOperation
```php
public function endOperation(
object|null $span,
bool $success,
Throwable|null $exception = NULL,
array<string, mixed> $attributes = [],
): void
```
End tracing for an OpenFGA API operation. Completes the trace span started with startOperation(), recording the operation outcome and any relevant metrics. If an exception occurred during the operation, it should be recorded in the span.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L59)
###### Parameters
| Name | Type | Description |
| ------------- | -------------------------------- | ----------------------------------------------------- |
| `$span` | `object` | `null` | The span identifier returned by startOperation() |
| `$success` | `bool` | Whether the operation completed successfully |
| `$exception` | `Throwable` | `null` | Optional exception that occurred during the operation |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`void`
##### recordAuthenticationEvent
```php
public function recordAuthenticationEvent(
string $event,
bool $success,
float $duration,
array<string, mixed> $attributes = [],
): void
```
Record authentication events. Records metrics and traces related to authentication flows, including token acquisition, refresh operations, and authentication failures. This helps monitor authentication performance and troubleshoot auth issues.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L78)
###### Parameters
| Name | Type | Description |
| ------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `$event` | `string` | The authentication event type ('token_request', 'token_refresh', 'auth_failure') |
| `$success` | `bool` | Whether the authentication event was successful |
| `$duration` | `float` | The duration of the authentication operation in seconds |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`void`
##### recordCircuitBreakerState
```php
public function recordCircuitBreakerState(
string $endpoint,
string $state,
int $failures,
float $failureRate,
): void
```
Record circuit breaker state changes. Records metrics about circuit breaker state transitions and failure rates. This helps monitor the health of individual API endpoints and the SDK's resilience mechanisms.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L97)
###### Parameters
| Name | Type | Description |
| -------------- | -------- | ------------------------------------------------------------------------------------------- |
| `$endpoint` | `string` | The API endpoint this circuit breaker protects |
| `$state` | `string` | The new circuit breaker state ('open', 'closed', 'half_open') |
| `$failures` | `int` | The current failure count |
| `$failureRate` | `float` | The current failure rate (0.0 to 1.0) |
###### Returns
`void`
##### recordOperationMetrics
```php
public function recordOperationMetrics(
string $operation,
float $duration,
StoreInterface|string $store,
AuthorizationModelInterface|string|null $model = NULL,
array<string, mixed> $attributes = [],
): void
```
Record performance metrics for OpenFGA operations. Records timing and throughput metrics for OpenFGA API operations, allowing monitoring of operation latency and identifying performance bottlenecks or degradations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L117)
###### Parameters
| Name | Type | Description |
| ------------- | ---------------------------------------------------------------------------------------------------- | --------------------------------- |
| `$operation` | `string` | The OpenFGA operation name |
| `$duration` | `float` | The operation duration in seconds |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store being operated on |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` | The authorization model used |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`void`
##### recordRetryAttempt
```php
public function recordRetryAttempt(
string $endpoint,
int $attempt,
int $delayMs,
string $outcome,
Throwable|null $exception = NULL,
): void
```
Record retry attempt metrics. Records metrics about retry attempts, including the retry count, delay, and eventual outcome. This helps track the reliability and performance of API requests under various network conditions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L138)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------- | ----------------------------------------------------------------------------------------- |
| `$endpoint` | `string` | The API endpoint being retried |
| `$attempt` | `int` | The current attempt number (1-based) |
| `$delayMs` | `int` | The delay before this attempt in milliseconds |
| `$outcome` | `string` | The outcome of this attempt ('success', 'failure', 'retry') |
| `$exception` | `Throwable` | `null` | Optional exception from this attempt |
###### Returns
`void`
##### recordSpan
```php
public function recordSpan(string $name, array<string, mixed> $attributes = []): void
```
Record a telemetry span with attributes. Records a complete telemetry span for events that don't require start/end semantics. This is useful for event-driven telemetry where the event represents a point in time rather than a duration.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L156)
###### Parameters
| Name | Type | Description |
| ------------- | -------------------------------- | ------------- |
| `$name` | `string` | The span name |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`void`
##### startHttpRequest
```php
public function startHttpRequest(RequestInterface $request): object|null
```
Start tracing an HTTP request. Creates a new trace span for an outgoing HTTP request to the OpenFGA API. The span should follow OpenTelemetry semantic conventions for HTTP client operations, including standard HTTP attributes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L168)
###### Parameters
| Name | Type | Description |
| ---------- | -------------------------------------------------- | --------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The HTTP request being sent |
###### Returns
`object` | `null` — A span identifier or context that can be passed to endHttpRequest()
##### startOperation
```php
public function startOperation(
string $operation,
StoreInterface|string $store,
AuthorizationModelInterface|string|null $model = NULL,
array<string, mixed> $attributes = [],
): object|null
```
Start tracing an OpenFGA API operation. Creates a new trace span for a high-level OpenFGA operation such as check, expand, or write operations. The span should include relevant attributes such as store ID, authorization model ID, and operation-specific metadata.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Observability/TelemetryInterface.php#L183)
###### Parameters
| Name | Type | Description |
| ------------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `$operation` | `string` | The OpenFGA operation name (for example 'check', 'expand', 'write_tuples') |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store being operated on |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` | The authorization model being used |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`object` | `null` — A span identifier or context that can be passed to endOperation()
<!-- End of evansims/openfga-php/docs/API/Observability/TelemetryInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/AssertionRepositoryInterface.md -->
### AssertionRepositoryInterface
Repository interface for managing OpenFGA authorization model assertions. This interface provides data access operations for working with assertions, which are test cases that validate the behavior of authorization models. Implementations handle the underlying storage and retrieval mechanisms.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`read()`](#read)
- [`write()`](#write)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/AssertionRepositoryInterface.php)
#### Methods
##### read
```php
public function read(string $authorizationModelId): FailureInterface|SuccessInterface
```
Read assertions from an authorization model. Retrieves all test assertions defined for the specified authorization model. Assertions validate that the model behaves correctly for specific scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/AssertionRepositoryInterface.php#L30)
###### Parameters
| Name | Type | Description |
| ----------------------- | -------- | ------------------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID containing assertions |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with assertions collection, or Failure with error details
##### write
```php
public function write(string $authorizationModelId, AssertionsInterface $assertions): FailureInterface|SuccessInterface
```
Write assertions to an authorization model. Updates the test assertions for the specified authorization model. This replaces any existing assertions with the provided collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/AssertionRepositoryInterface.php#L42)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID to update |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to write |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if written, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Repositories/AssertionRepositoryInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/HttpAssertionRepository.md -->
### HttpAssertionRepository
HTTP implementation of assertion repository for OpenFGA API communication. This repository handles assertion operations by communicating with the OpenFGA HTTP API. It transforms business operations into HTTP requests and responses, handling serialization, deserialization, and error management.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`read()`](#read)
- [`write()`](#write)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpAssertionRepository.php)
#### Implements
- [`AssertionRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/AssertionRepositoryInterface.md)
#### Methods
##### read
```php
public function read(
string $authorizationModelId,
): OpenFGA\Results\Failure|OpenFGA\Results\Success|OpenFGA\Results\SuccessInterface
```
Read assertions from an authorization model. Retrieves all test assertions defined for the specified authorization model. Assertions validate that the model behaves correctly for specific scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpAssertionRepository.php#L48)
###### Parameters
| Name | Type | Description |
| ----------------------- | -------- | ------------------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID containing assertions |
###### Returns
[`Failure`](https://github.com/evansims/openfga-php/blob/main/Results/Failure.md) | [`Success`](https://github.com/evansims/openfga-php/blob/main/Results/Success.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with assertions collection, or Failure with error details
##### write
```php
public function write(
string $authorizationModelId,
OpenFGA\Models\Collections\AssertionsInterface $assertions,
): OpenFGA\Results\Failure|OpenFGA\Results\Success|OpenFGA\Results\SuccessInterface
```
Write assertions to an authorization model. Updates the test assertions for the specified authorization model. This replaces any existing assertions with the provided collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpAssertionRepository.php#L80)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID to update |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to write |
###### Returns
[`Failure`](https://github.com/evansims/openfga-php/blob/main/Results/Failure.md) | [`Success`](https://github.com/evansims/openfga-php/blob/main/Results/Success.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if written, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Repositories/HttpAssertionRepository.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/HttpModelRepository.md -->
### HttpModelRepository
HTTP implementation of the model repository. This repository handles authorization model operations via HTTP requests to the OpenFGA API. It converts domain objects to API requests, sends them via the HTTP service, and transforms responses back to domain objects. Supports creating, retrieving, and listing authorization models within a store. Authorization models define the permission structure for your application - the types of objects, the relationships between them, and the rules that govern access. Models are immutable once created; to update permissions, you create a new model version.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`create()`](#create)
- [`get()`](#get)
- [`list()`](#list)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpModelRepository.php)
#### Implements
- [`ModelRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/ModelRepositoryInterface.md)
#### Methods
##### create
```php
public function create(
OpenFGA\Models\Collections\TypeDefinitionsInterface $typeDefinitions,
OpenFGA\Models\Enums\SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
?OpenFGA\Models\Collections\ConditionsInterface $conditions = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Create a new authorization model in the store. Creates an immutable authorization model that defines your application's permission structure. The model includes type definitions for objects and the relationships between them, and optionally conditions for dynamic permissions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpModelRepository.php#L68)
###### Parameters
| Name | Type | Description |
| ------------------ | -------------------------------------------------------------------------------- | -------------------------------------------------- |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | Object types and their relationship definitions |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The schema version for the model (defaults to 1.1) |
| `$conditions` | [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` | Optional conditions for dynamic permissions |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the created AuthorizationModelInterface, or Failure with error details
##### get
```php
public function get(string $modelId): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Get a specific authorization model by ID. Retrieves the complete authorization model including all type definitions, relationships, and conditions. Models are immutable, so the returned model will never change once created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpModelRepository.php#L106)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ------------------------------------------------ |
| `$modelId` | `string` | The unique identifier of the authorization model |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the AuthorizationModelInterface, or Failure with error details
##### list
```php
public function list(
?int $pageSize = NULL,
?string $continuationToken = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
List authorization models in the store. Returns a paginated list of authorization models, ordered by creation time (newest first). Use pagination parameters to retrieve large lists efficiently.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpModelRepository.php#L139)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | ------------------------------------------- |
| `$pageSize` | `int` | `null` | Maximum number of models to return (1-100) |
| `$continuationToken` | `string` | `null` | Token from previous response for pagination |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with AuthorizationModelsInterface collection, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Repositories/HttpModelRepository.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/HttpStoreRepository.md -->
### HttpStoreRepository
HTTP implementation of the store repository. This repository provides a domain-focused abstraction for store operations, handling all HTTP communication through the injected HttpService. It converts domain objects to API requests, sends them via HTTP, and transforms responses back to domain objects while maintaining proper error handling. The repository encapsulates all HTTP-specific concerns including request/response transformation, pagination handling, and API error mapping. It follows the SDK's Result pattern to provide safe error handling without exceptions for control flow. ## Implementation Details - Uses HttpService for all HTTP operations - Validates responses using SchemaValidator - Transforms API responses to domain objects - Handles pagination for list operations - Provides consistent error handling via Result pattern
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`create()`](#create)
- [`delete()`](#delete)
- [`get()`](#get)
- [`list()`](#list)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpStoreRepository.php)
#### Implements
- [`StoreRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/StoreRepositoryInterface.md)
#### Methods
##### create
```php
public function create(string $name): OpenFGA\Results\ResultInterface
```
Create a new store with the specified name. Creates a new OpenFGA store which serves as a container for authorization models and relationship tuples. Each store is isolated from others, allowing you to manage multiple authorization configurations in a single OpenFGA instance.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpStoreRepository.php#L66)
###### Parameters
| Name | Type | Description |
| ------- | -------- | -------------------------- |
| `$name` | `string` | The name for the new store |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success containing the created Store, or Failure with error details
##### delete
```php
public function delete(string $storeId): OpenFGA\Results\ResultInterface
```
Delete an existing store by ID. Permanently removes a store and all its associated data including authorization models and relationship tuples. This operation cannot be undone, so use with caution in production environments.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpStoreRepository.php#L109)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ----------------------------- |
| `$storeId` | `string` | The ID of the store to delete |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success with null value, or Failure with error details
##### get
```php
public function get(string $storeId): OpenFGA\Results\ResultInterface
```
Get a store by ID. Retrieves the details of an existing store including its name and timestamps. Use this to verify a store exists or to get its current metadata.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpStoreRepository.php#L139)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ------------------------------- |
| `$storeId` | `string` | The ID of the store to retrieve |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success containing the Store, or Failure with error details
##### list
```php
public function list(?string $continuationToken = NULL, ?int $pageSize = NULL): OpenFGA\Results\ResultInterface
```
List available stores with optional pagination. Retrieves a paginated list of all stores accessible to the authenticated client. Use the continuation token from a previous response to fetch subsequent pages when dealing with large numbers of stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpStoreRepository.php#L169)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | --------------------------------------------- |
| `$continuationToken` | `string` | `null` | Token from previous response to get next page |
| `$pageSize` | `int` | `null` | Maximum number of stores to return (1-100) |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success containing Stores collection, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Repositories/HttpStoreRepository.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/HttpTupleRepository.md -->
### HttpTupleRepository
HTTP implementation of the tuple repository. This repository handles tuple operations via HTTP requests to the OpenFGA API. It converts domain objects to API requests, sends them via the HTTP service, and transforms responses back to domain objects. Supports both transactional and non-transactional tuple operations with proper error handling.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`delete()`](#delete)
- [`listChanges()`](#listchanges)
- [`read()`](#read)
- [`write()`](#write)
- [`writeAndDelete()`](#writeanddelete)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpTupleRepository.php)
#### Implements
- [`TupleRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/TupleRepositoryInterface.md)
#### Methods
##### delete
```php
public function delete(
OpenFGA\Models\StoreInterface $store,
OpenFGA\Models\AuthorizationModelInterface $model,
OpenFGA\Models\Collections\TupleKeysInterface $tuples,
bool $transactional = true,
array $options = [],
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Delete relationship tuples from the store. Removes existing relationship tuples from the store. Like write operations, supports both transactional and non-transactional modes with the same constraints and options.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpTupleRepository.php#L62)
###### Parameters
| Name | Type | Description |
| ---------------- | ---------------------------------------------------------------------- | ------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store containing the tuples |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | The authorization model to validate against |
| `$tuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | The tuples to delete |
| `$transactional` | `bool` | Whether to use transactional mode (default: true) |
| `$options` | `array` | |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with WriteTuplesResponse containing operation results, or Failure with error details
##### listChanges
```php
public function listChanges(
OpenFGA\Models\StoreInterface $store,
?string $type = NULL,
?DateTimeImmutable $startTime = NULL,
?string $continuationToken = NULL,
?int $pageSize = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
List changes to relationship tuples over time. Retrieves a chronological log of tuple changes (writes and deletes) within the store. Useful for auditing, synchronization, or understanding how relationships evolved. Results can be filtered by object type and time range.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpTupleRepository.php#L115)
###### Parameters
| Name | Type | Description |
| -------------------- | -------------------------------------------- | -------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store to query |
| `$type` | `string` | `null` | Filter by object type (for example "document") |
| `$startTime` | `DateTimeImmutable` | `null` | Filter changes after this time |
| `$continuationToken` | `string` | `null` | Token from previous response for pagination |
| `$pageSize` | `int` | `null` | Maximum number of changes to return |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ListTupleChangesResponse containing change history, or Failure with error details
##### read
```php
public function read(
OpenFGA\Models\StoreInterface $store,
OpenFGA\Models\TupleKeyInterface $filter,
?string $continuationToken = NULL,
?int $pageSize = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Read relationship tuples from the store. Retrieves tuples matching the specified filter criteria. The filter uses partial matching - you can specify any combination of user, relation, and object to narrow results. Results are paginated for efficient retrieval of large datasets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpTupleRepository.php#L156)
###### Parameters
| Name | Type | Description |
| -------------------- | -------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store containing the tuples |
| `$filter` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | Filter criteria for tuple matching |
| `$continuationToken` | `string` | `null` | Token from previous response for pagination |
| `$pageSize` | `int` | `null` | Maximum number of tuples to return (1-100) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ReadTuplesResponse containing matching tuples, or Failure with error details
##### write
```php
public function write(
OpenFGA\Models\StoreInterface $store,
OpenFGA\Models\AuthorizationModelInterface $model,
OpenFGA\Models\Collections\TupleKeysInterface $tuples,
bool $transactional = true,
array $options = [],
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Write relationship tuples to the store. Creates new relationship tuples in the store. Supports both transactional mode (all-or-nothing, limited to 100 tuples) and non-transactional mode for larger batches with configurable parallelism and retry behavior.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpTupleRepository.php#L196)
###### Parameters
| Name | Type | Description |
| ---------------- | ---------------------------------------------------------------------- | ------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store to write tuples to |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | The authorization model to validate against |
| `$tuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | The tuples to write |
| `$transactional` | `bool` | Whether to use transactional mode (default: true) |
| `$options` | `array` | |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with WriteTuplesResponse containing operation results, or Failure with error details
##### writeAndDelete
```php
public function writeAndDelete(
StoreInterface $store,
AuthorizationModelInterface $model,
TupleKeysInterface|null $writes = NULL,
TupleKeysInterface|null $deletes = NULL,
bool $transactional = true,
array<string, mixed> $options = [],
): FailureInterface|SuccessInterface
```
Write and delete tuples in a single operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/HttpTupleRepository.php#L257)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------------------------------------------------------------ | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store to operate on |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | The authorization model to validate against |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to write (optional) |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to delete (optional) |
| `$transactional` | `bool` | Whether to use transactional mode |
| `$options` | `array<`string`, `mixed`>` | |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Result of the operation
<!-- End of evansims/openfga-php/docs/API/Repositories/HttpTupleRepository.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/ModelRepositoryInterface.md -->
### ModelRepositoryInterface
Repository contract for authorization model operations. This interface defines the contract for managing authorization models within an OpenFGA store. Authorization models define the permission structure for your application - the types of objects, the relationships between them, and the rules that govern access. Models are immutable once created; to update permissions, you create a new model version. All methods return Result objects following the Result pattern, allowing for consistent error handling without exceptions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`create()`](#create)
- [`get()`](#get)
- [`list()`](#list)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/ModelRepositoryInterface.php)
#### Methods
##### create
```php
public function create(
TypeDefinitionsInterface $typeDefinitions,
SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
ConditionsInterface|null $conditions = NULL,
): FailureInterface|SuccessInterface
```
Create a new authorization model in the store. Creates an immutable authorization model that defines your application's permission structure. The model includes type definitions for objects and the relationships between them, and optionally conditions for dynamic permissions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/ModelRepositoryInterface.php#L40)
###### Parameters
| Name | Type | Description |
| ------------------ | -------------------------------------------------------------------------------- | -------------------------------------------------- |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | Object types and their relationship definitions |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The schema version for the model (defaults to 1.1) |
| `$conditions` | [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` | Optional conditions for dynamic permissions |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the created AuthorizationModelInterface, or Failure with error details
##### get
```php
public function get(string $modelId): FailureInterface|SuccessInterface
```
Get a specific authorization model by ID. Retrieves the complete authorization model including all type definitions, relationships, and conditions. Models are immutable, so the returned model will never change once created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/ModelRepositoryInterface.php#L58)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ------------------------------------------------ |
| `$modelId` | `string` | The unique identifier of the authorization model |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the AuthorizationModelInterface, or Failure with error details
##### list
```php
public function list(
int|null $pageSize = NULL,
string|null $continuationToken = NULL,
): FailureInterface|SuccessInterface
```
List authorization models in the store. Returns a paginated list of authorization models, ordered by creation time (newest first). Use pagination parameters to retrieve large lists efficiently.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/ModelRepositoryInterface.php#L72)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | ------------------------------------------- |
| `$pageSize` | `int` | `null` | Maximum number of models to return (1-100) |
| `$continuationToken` | `string` | `null` | Token from previous response for pagination |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with AuthorizationModelsInterface collection, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Repositories/ModelRepositoryInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/README.md -->
## Repositories
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Repositories
Data access interfaces and implementations for managing OpenFGA resources.
**Total Components:** 8
### Interfaces
| Name | Description |
|------|-------------|
| [`AssertionRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./AssertionRepositoryInterface.md) | Repository interface for managing OpenFGA authorization model assertions. This interface provides... |
| [`ModelRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./ModelRepositoryInterface.md) | Repository contract for authorization model operations. This interface defines the contract for m... |
| [`StoreRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./StoreRepositoryInterface.md) | Repository interface for store operations. This interface defines the contract for store reposito... |
| [`TupleRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleRepositoryInterface.md) | Repository contract for relationship tuple operations. This interface defines the contract for ma... |
### Classes
| Name | Description |
|------|-------------|
| [`HttpAssertionRepository`](https://github.com/evansims/openfga-php/blob/main/./HttpAssertionRepository.md) | HTTP implementation of assertion repository for OpenFGA API communication. This repository handle... |
| [`HttpModelRepository`](https://github.com/evansims/openfga-php/blob/main/./HttpModelRepository.md) | HTTP implementation of the model repository. This repository handles authorization model operatio... |
| [`HttpStoreRepository`](https://github.com/evansims/openfga-php/blob/main/./HttpStoreRepository.md) | HTTP implementation of the store repository. This repository provides a domain-focused abstractio... |
| [`HttpTupleRepository`](https://github.com/evansims/openfga-php/blob/main/./HttpTupleRepository.md) | HTTP implementation of the tuple repository. This repository handles tuple operations via HTTP re... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Repositories/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/StoreRepositoryInterface.md -->
### StoreRepositoryInterface
Repository interface for store operations. This interface defines the contract for store repository implementations, providing a domain-focused abstraction for store management operations. All methods follow the Result pattern, returning either Success or Failure objects to enable safe error handling without exceptions for control flow. Implementations should handle all infrastructure concerns such as HTTP communication, data persistence, or caching while presenting a clean domain interface to the application layer.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`create()`](#create)
- [`delete()`](#delete)
- [`get()`](#get)
- [`list()`](#list)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/StoreRepositoryInterface.php)
#### Methods
##### create
```php
public function create(string $name): ResultInterface
```
Create a new store with the specified name. Creates a new OpenFGA store which serves as a container for authorization models and relationship tuples. Each store is isolated from others, allowing you to manage multiple authorization configurations in a single OpenFGA instance.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/StoreRepositoryInterface.php#L35)
###### Parameters
| Name | Type | Description |
| ------- | -------- | -------------------------- |
| `$name` | `string` | The name for the new store |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success containing the created Store, or Failure with error details
##### delete
```php
public function delete(string $storeId): ResultInterface
```
Delete an existing store by ID. Permanently removes a store and all its associated data including authorization models and relationship tuples. This operation cannot be undone, so use with caution in production environments.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/StoreRepositoryInterface.php#L47)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ----------------------------- |
| `$storeId` | `string` | The ID of the store to delete |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success with null value, or Failure with error details
##### get
```php
public function get(string $storeId): ResultInterface
```
Get a store by ID. Retrieves the details of an existing store including its name and timestamps. Use this to verify a store exists or to get its current metadata.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/StoreRepositoryInterface.php#L58)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ------------------------------- |
| `$storeId` | `string` | The ID of the store to retrieve |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success containing the Store, or Failure with error details
##### list
```php
public function list(string|null $continuationToken = NULL, int|null $pageSize = NULL): ResultInterface
```
List available stores with optional pagination. Retrieves a paginated list of all stores accessible to the authenticated client. Use the continuation token from a previous response to fetch subsequent pages when dealing with large numbers of stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/StoreRepositoryInterface.php#L71)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | --------------------------------------------- |
| `$continuationToken` | `string` | `null` | Token from previous response to get next page |
| `$pageSize` | `int` | `null` | Maximum number of stores to return (1-100) |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/Results/ResultInterface.md) — Success containing Stores collection, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Repositories/StoreRepositoryInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Repositories/TupleRepositoryInterface.md -->
### TupleRepositoryInterface
Repository contract for relationship tuple operations. This interface defines the contract for managing relationship tuples within an OpenFGA store. Tuples represent relationships between users and objects (for example "user:anne is reader of document:budget"), forming the core data that drives authorization decisions. The repository supports both transactional and non-transactional operations for different scale and consistency requirements. All methods return Result objects following the Result pattern, allowing for consistent error handling without exceptions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Methods](#methods)
- [`delete()`](#delete)
- [`listChanges()`](#listchanges)
- [`read()`](#read)
- [`write()`](#write)
- [`writeAndDelete()`](#writeanddelete)
</details>
#### Namespace
`OpenFGA\Repositories`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Repositories/TupleRepositoryInterface.php)
#### Methods
##### delete
```php
public function delete(
StoreInterface $store,
AuthorizationModelInterface $model,
TupleKeysInterface $tuples,
bool $transactional = true,
array<string, mixed> $options = [],
): FailureInterface|SuccessInterface
```
Delete relationship tuples from the store. Removes existing relationship tuples from the store. Like write operations, supports both transactional and non-transactional modes with the same constraints and options.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/TupleRepositoryInterface.php#L43)
###### Parameters
| Name | Type | Description |
| ---------------- | ---------------------------------------------------------------------- | ------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store containing the tuples |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | The authorization model to validate against |
| `$tuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | The tuples to delete |
| `$transactional` | `bool` | Whether to use transactional mode (default: true) |
| `$options` | `array<`string`, `mixed`>` | |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with WriteTuplesResponse containing operation results, or Failure with error details
##### listChanges
```php
public function listChanges(
StoreInterface $store,
string|null $type = NULL,
DateTimeImmutable|null $startTime = NULL,
string|null $continuationToken = NULL,
int|null $pageSize = NULL,
): FailureInterface|SuccessInterface
```
List changes to relationship tuples over time. Retrieves a chronological log of tuple changes (writes and deletes) within the store. Useful for auditing, synchronization, or understanding how relationships evolved. Results can be filtered by object type and time range.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/TupleRepositoryInterface.php#L67)
###### Parameters
| Name | Type | Description |
| -------------------- | -------------------------------------------- | -------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store to query |
| `$type` | `string` | `null` | Filter by object type (for example "document") |
| `$startTime` | `DateTimeImmutable` | `null` | Filter changes after this time |
| `$continuationToken` | `string` | `null` | Token from previous response for pagination |
| `$pageSize` | `int` | `null` | Maximum number of changes to return |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ListTupleChangesResponse containing change history, or Failure with error details
##### read
```php
public function read(
StoreInterface $store,
TupleKeyInterface $filter,
string|null $continuationToken = NULL,
int|null $pageSize = NULL,
): FailureInterface|SuccessInterface
```
Read relationship tuples from the store. Retrieves tuples matching the specified filter criteria. The filter uses partial matching - you can specify any combination of user, relation, and object to narrow results. Results are paginated for efficient retrieval of large datasets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/TupleRepositoryInterface.php#L90)
###### Parameters
| Name | Type | Description |
| -------------------- | -------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store containing the tuples |
| `$filter` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | Filter criteria for tuple matching |
| `$continuationToken` | `string` | `null` | Token from previous response for pagination |
| `$pageSize` | `int` | `null` | Maximum number of tuples to return (1-100) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ReadTuplesResponse containing matching tuples, or Failure with error details
##### write
```php
public function write(
StoreInterface $store,
AuthorizationModelInterface $model,
TupleKeysInterface $tuples,
bool $transactional = true,
array<string, mixed> $options = [],
): FailureInterface|SuccessInterface
```
Write relationship tuples to the store. Creates new relationship tuples in the store. Supports both transactional mode (all-or-nothing, limited to 100 tuples) and non-transactional mode for larger batches with configurable parallelism and retry behavior.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/TupleRepositoryInterface.php#L118)
###### Parameters
| Name | Type | Description |
| ---------------- | ---------------------------------------------------------------------- | ------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store to write tuples to |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | The authorization model to validate against |
| `$tuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | The tuples to write |
| `$transactional` | `bool` | Whether to use transactional mode (default: true) |
| `$options` | `array<`string`, `mixed`>` | |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with WriteTuplesResponse containing operation results, or Failure with error details
##### writeAndDelete
```php
public function writeAndDelete(
StoreInterface $store,
AuthorizationModelInterface $model,
TupleKeysInterface|null $writes = NULL,
TupleKeysInterface|null $deletes = NULL,
bool $transactional = true,
array<string, mixed> $options = [],
): FailureInterface|SuccessInterface
```
Write and delete relationship tuples in a single operation. Combines write and delete operations for efficiency, especially useful when you need to atomically replace relationships. In transactional mode, all operations succeed or fail together. In non-transactional mode, operations are batched for optimal performance.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Repositories/TupleRepositoryInterface.php#L144)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------------------------------------------------------------ | ------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | The store to operate on |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | The authorization model to validate against |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to write (optional) |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to delete (optional) |
| `$transactional` | `bool` | Whether to use transactional mode (default: true) |
| `$options` | `array<`string`, `mixed`>` | |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with WriteTuplesResponse containing operation results, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Repositories/TupleRepositoryInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/BatchCheckRequest.md -->
### BatchCheckRequest
Request for performing multiple authorization checks in a single batch. This request allows checking multiple user-object relationships simultaneously for better performance when multiple authorization decisions are needed. Each check in the batch has a correlation ID to map results back to the original requests.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getChecks()`](#getchecks)
- [`getRequest()`](#getrequest)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/BatchCheckRequest.php)
#### Implements
- [`BatchCheckRequestInterface`](https://github.com/evansims/openfga-php/blob/main/BatchCheckRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [BatchCheckResponse](https://github.com/evansims/openfga-php/blob/main/Responses/BatchCheckResponse.md) (response)
- [BatchCheckRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/BatchCheckRequestInterface.md) (interface)
#### Methods
##### getChecks
```php
public function getChecks(): OpenFGA\Models\Collections\BatchCheckItemsInterface
```
Get the collection of checks to perform in this batch. Each item contains a tuple key to check and a correlation ID to map the result back to this specific check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/BatchCheckRequest.php#L63)
###### Returns
[`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/BatchCheckItemsInterface.md) — The batch check items
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/BatchCheckRequest.php#L72)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
<!-- End of evansims/openfga-php/docs/API/Requests/BatchCheckRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/BatchCheckRequestInterface.md -->
### BatchCheckRequestInterface
Request for performing multiple authorization checks in a single batch. This request allows checking multiple user-object relationships simultaneously for better performance when multiple authorization decisions are needed. Each check in the batch has a correlation ID to map results back to the original requests. The batch check operation supports the same features as individual checks: contextual tuples, custom contexts, and detailed error information.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getChecks()`](#getchecks)
- [`getRequest()`](#getrequest)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/BatchCheckRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [BatchCheckResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/BatchCheckResponseInterface.md) (response)
- [BatchCheckRequest](https://github.com/evansims/openfga-php/blob/main/Requests/BatchCheckRequest.md) (implementation)
#### Methods
##### getChecks
```php
public function getChecks(): BatchCheckItemsInterface
```
Get the collection of checks to perform in this batch. Each item contains a tuple key to check and a correlation ID to map the result back to this specific check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/BatchCheckRequestInterface.php#L33)
###### Returns
[`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/BatchCheckItemsInterface.md) — The batch check items
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
<!-- End of evansims/openfga-php/docs/API/Requests/BatchCheckRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/CheckRequest.md -->
### CheckRequest
Request for performing authorization checks in OpenFGA. This request determines whether a user has a specific relationship with an object based on the configured authorization model and relationship tuples. It's the core operation for making authorization decisions in your application. The check operation supports contextual tuples, custom contexts, and tracing to provide comprehensive authorization decisions with detailed debugging information.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAuthorizationModel()`](#getauthorizationmodel)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getTrace()`](#gettrace)
- [`getTupleKey()`](#gettuplekey)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php)
#### Implements
- [`CheckRequestInterface`](https://github.com/evansims/openfga-php/blob/main/CheckRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [CheckResponse](https://github.com/evansims/openfga-php/blob/main/Responses/CheckResponse.md) (response)
- [CheckRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/CheckRequestInterface.md) (interface)
#### Methods
##### getAuthorizationModel
```php
public function getAuthorizationModel(): string
```
Get the authorization model ID to use for the check. This specifies which version of the authorization model should be used when evaluating the permission check. Using a specific model ID ensures consistent results.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L73)
###### Returns
`string` — The authorization model ID for permission evaluation
##### getConsistency
```php
public function getConsistency(): ?OpenFGA\Models\Enums\Consistency
```
Get the consistency level for the check operation. This determines the read consistency requirement for the check operation, allowing you to balance between read performance and data consistency based on your application's needs.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L82)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level, or null to use the default consistency setting
##### getContext
```php
public function getContext(): ?object
```
Get additional context data for conditional evaluation. This provides contextual information that can be used in conditional expressions within the authorization model, enabling dynamic permission evaluation based on runtime data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L91)
###### Returns
`object` | `null` — The context object containing additional data for evaluation, or null if no context is provided
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get additional tuples to consider during the check. These contextual tuples are temporarily added to the authorization data during evaluation, allowing you to test permission scenarios with hypothetical or pending relationship changes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L100)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L109)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. This identifies which OpenFGA store contains the relationship tuples and configuration to use for the permission check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L135)
###### Returns
`string` — The store ID containing the authorization data
##### getTrace
```php
public function getTrace(): ?bool
```
Get whether to include evaluation trace in the response. When enabled, the response will include detailed information about how the permission decision was reached, which is useful for debugging authorization logic.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L144)
###### Returns
`bool` | `null` — Whether to include trace information, or null to use the default setting
##### getTupleKey
```php
public function getTupleKey(): OpenFGA\Models\TupleKeyInterface
```
Get the relationship tuple to check for permission. This defines the specific relationship (user, object, relation) to evaluate for authorization. For example, checking if "user:alice" has "can_view" permission on "document:readme."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequest.php#L153)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) — The relationship tuple specifying what permission to check
<!-- End of evansims/openfga-php/docs/API/Requests/CheckRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/CheckRequestInterface.md -->
### CheckRequestInterface
Interface for authorization check request specifications. This interface defines the contract for creating authorization check requests that determine whether a user has a specific relationship with an object. It's the core interface for implementing permission verification in applications.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAuthorizationModel()`](#getauthorizationmodel)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getTrace()`](#gettrace)
- [`getTupleKey()`](#gettuplekey)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [CheckResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/CheckResponseInterface.md) (response)
- [CheckRequest](https://github.com/evansims/openfga-php/blob/main/Requests/CheckRequest.md) (implementation)
#### Methods
##### getAuthorizationModel
```php
public function getAuthorizationModel(): string
```
Get the authorization model ID to use for the check. This specifies which version of the authorization model should be used when evaluating the permission check. Using a specific model ID ensures consistent results.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php#L30)
###### Returns
`string` — The authorization model ID for permission evaluation
##### getConsistency
```php
public function getConsistency(): Consistency|null
```
Get the consistency level for the check operation. This determines the read consistency requirement for the check operation, allowing you to balance between read performance and data consistency based on your application's needs.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php#L40)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level, or null to use the default consistency setting
##### getContext
```php
public function getContext(): object|null
```
Get additional context data for conditional evaluation. This provides contextual information that can be used in conditional expressions within the authorization model, enabling dynamic permission evaluation based on runtime data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php#L50)
###### Returns
`object` | `null` — The context object containing additional data for evaluation, or null if no context is provided
##### getContextualTuples
```php
public function getContextualTuples(): TupleKeysInterface|null
```
Get additional tuples to consider during the check. These contextual tuples are temporarily added to the authorization data during evaluation, allowing you to test permission scenarios with hypothetical or pending relationship changes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php#L60)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. This identifies which OpenFGA store contains the relationship tuples and configuration to use for the permission check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php#L70)
###### Returns
`string` — The store ID containing the authorization data
##### getTrace
```php
public function getTrace(): bool|null
```
Get whether to include evaluation trace in the response. When enabled, the response will include detailed information about how the permission decision was reached, which is useful for debugging authorization logic.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php#L80)
###### Returns
`bool` | `null` — Whether to include trace information, or null to use the default setting
##### getTupleKey
```php
public function getTupleKey(): TupleKeyInterface
```
Get the relationship tuple to check for permission. This defines the specific relationship (user, object, relation) to evaluate for authorization. For example, checking if "user:alice" has "can_view" permission on "document:readme."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CheckRequestInterface.php#L90)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) — The relationship tuple specifying what permission to check
<!-- End of evansims/openfga-php/docs/API/Requests/CheckRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/CreateAuthorizationModelRequest.md -->
### CreateAuthorizationModelRequest
Request for creating a new authorization model in OpenFGA. Authorization models define the permission structure for your application, including object types, relationships, and how permissions are computed. Models are immutable once created and identified by a unique ID.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConditions()`](#getconditions)
- [`getRequest()`](#getrequest)
- [`getSchemaVersion()`](#getschemaversion)
- [`getStore()`](#getstore)
- [`getTypeDefinitions()`](#gettypedefinitions)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequest.php)
#### Implements
- [`CreateAuthorizationModelRequestInterface`](https://github.com/evansims/openfga-php/blob/main/CreateAuthorizationModelRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [CreateAuthorizationModelResponse](https://github.com/evansims/openfga-php/blob/main/Responses/CreateAuthorizationModelResponse.md) (response)
- [CreateAuthorizationModelRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/CreateAuthorizationModelRequestInterface.md) (interface)
#### Methods
##### getConditions
```php
public function getConditions(): ?OpenFGA\Models\Collections\ConditionsInterface
```
Get the conditional rules for the authorization model. Returns a collection of conditions that define dynamic authorization logic based on runtime context. Conditions allow for sophisticated access control scenarios such as time-based access, location restrictions, resource attributes, or custom business logic. Conditions are referenced by name within type definitions and evaluated at permission check time using contextual data provided in authorization requests. They enable attribute-based access control (ABAC) patterns within the relationship-based authorization framework.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequest.php#L58)
###### Returns
[`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` — Collection of conditional rules for dynamic authorization, or null if no conditions are defined
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequest.php#L69)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getSchemaVersion
```php
public function getSchemaVersion(): OpenFGA\Models\Enums\SchemaVersion
```
Get the schema version for the authorization model. Specifies which version of the OpenFGA modeling language should be used to interpret the authorization model definition. Different schema versions support different features and syntax, allowing OpenFGA to evolve while maintaining backward compatibility. The schema version determines: - Available relationship operators and syntax - Supported conditional expression features - Type definition validation rules - API compatibility and behavior
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequest.php#L97)
###### Returns
[`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) — The modeling language schema version for this authorization model
##### getStore
```php
public function getStore(): string
```
Get the store ID where the authorization model will be created. Identifies the OpenFGA store that will contain the new authorization model. Each store can have multiple model versions, allowing you to evolve your authorization schema over time while maintaining access to previous versions for consistency and rollback scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequest.php#L106)
###### Returns
`string` — The store ID where the authorization model will be created
##### getTypeDefinitions
```php
public function getTypeDefinitions(): OpenFGA\Models\Collections\TypeDefinitionsInterface
```
Get the type definitions for the authorization model. Returns a collection of type definitions that specify the object types and their allowed relationships within the authorization model. Type definitions form the core schema that defines what objects exist in your system and how they can be related to users and other objects. Each type definition includes: - Object type name (for example "document," "folder," "organization") - Allowed relationships (for example "owner," "editor," "viewer") - Relationship inheritance and computation rules - References to conditional logic for dynamic authorization
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequest.php#L115)
###### Returns
[`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) — Collection of object type definitions that define the authorization schema
<!-- End of evansims/openfga-php/docs/API/Requests/CreateAuthorizationModelRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/CreateAuthorizationModelRequestInterface.md -->
### CreateAuthorizationModelRequestInterface
Interface for creating new authorization models in OpenFGA. This interface defines the contract for requests that create new authorization models within an OpenFGA store. Authorization models define the relationship types, object types, and access control rules that govern how permissions are evaluated in your application. An authorization model consists of: - **Type definitions**: Define object types and their allowed relationships - **Conditions**: Define conditional logic for dynamic authorization - **Schema version**: Specifies the model definition language version Authorization models are versioned, allowing you to evolve your permission system over time while maintaining compatibility. Each new model receives a unique ID that can be used to ensure consistent permission evaluation even as the model evolves. Key capabilities include: - Defining object types (documents, folders, organizations, etc.) - Specifying relationship types (owner, editor, viewer, member, etc.) - Creating inheritance and permission hierarchies - Implementing conditional authorization with runtime context - Supporting complex authorization patterns like RBAC, ABAC, and ReBAC
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConditions()`](#getconditions)
- [`getRequest()`](#getrequest)
- [`getSchemaVersion()`](#getschemaversion)
- [`getStore()`](#getstore)
- [`getTypeDefinitions()`](#gettypedefinitions)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [CreateAuthorizationModelResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/CreateAuthorizationModelResponseInterface.md) (response)
- [CreateAuthorizationModelRequest](https://github.com/evansims/openfga-php/blob/main/Requests/CreateAuthorizationModelRequest.md) (implementation)
#### Methods
##### getConditions
```php
public function getConditions(): ConditionsInterface|null
```
Get the conditional rules for the authorization model. Returns a collection of conditions that define dynamic authorization logic based on runtime context. Conditions allow for sophisticated access control scenarios such as time-based access, location restrictions, resource attributes, or custom business logic. Conditions are referenced by name within type definitions and evaluated at permission check time using contextual data provided in authorization requests. They enable attribute-based access control (ABAC) patterns within the relationship-based authorization framework.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequestInterface.php#L61)
###### Returns
[`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` — Collection of conditional rules for dynamic authorization, or null if no conditions are defined
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getSchemaVersion
```php
public function getSchemaVersion(): SchemaVersion
```
Get the schema version for the authorization model. Specifies which version of the OpenFGA modeling language should be used to interpret the authorization model definition. Different schema versions support different features and syntax, allowing OpenFGA to evolve while maintaining backward compatibility. The schema version determines: - Available relationship operators and syntax - Supported conditional expression features - Type definition validation rules - API compatibility and behavior
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequestInterface.php#L79)
###### Returns
[`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) — The modeling language schema version for this authorization model
##### getStore
```php
public function getStore(): string
```
Get the store ID where the authorization model will be created. Identifies the OpenFGA store that will contain the new authorization model. Each store can have multiple model versions, allowing you to evolve your authorization schema over time while maintaining access to previous versions for consistency and rollback scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequestInterface.php#L91)
###### Returns
`string` — The store ID where the authorization model will be created
##### getTypeDefinitions
```php
public function getTypeDefinitions(): TypeDefinitionsInterface
```
Get the type definitions for the authorization model. Returns a collection of type definitions that specify the object types and their allowed relationships within the authorization model. Type definitions form the core schema that defines what objects exist in your system and how they can be related to users and other objects. Each type definition includes: - Object type name (for example "document," "folder," "organization") - Allowed relationships (for example "owner," "editor," "viewer") - Relationship inheritance and computation rules - References to conditional logic for dynamic authorization
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateAuthorizationModelRequestInterface.php#L109)
###### Returns
[`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) — Collection of object type definitions that define the authorization schema
<!-- End of evansims/openfga-php/docs/API/Requests/CreateAuthorizationModelRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/CreateStoreRequest.md -->
### CreateStoreRequest
Request for creating a new OpenFGA store. Stores provide data isolation for different applications or environments, maintaining separate authorization models, relationship tuples, and providing complete separation from other stores.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getName()`](#getname)
- [`getRequest()`](#getrequest)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateStoreRequest.php)
#### Implements
- [`CreateStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/CreateStoreRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [CreateStoreResponse](https://github.com/evansims/openfga-php/blob/main/Responses/CreateStoreResponse.md) (response)
- [CreateStoreRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/CreateStoreRequestInterface.md) (interface)
#### Methods
##### getName
```php
public function getName(): string
```
Get the name for the new store. Returns the human-readable name that will be assigned to the new store. This name is used for identification and administrative purposes and should be descriptive enough to distinguish the store from others in your organization. The store name: - Must be a non-empty string - Should be descriptive and meaningful for administrative purposes - Is used for display in management interfaces and logging - Does not need to be globally unique (the store ID serves that purpose)
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateStoreRequest.php#L52)
###### Returns
`string` — The descriptive name for the new authorization store
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateStoreRequest.php#L63)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
<!-- End of evansims/openfga-php/docs/API/Requests/CreateStoreRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/CreateStoreRequestInterface.md -->
### CreateStoreRequestInterface
Interface for creating a new OpenFGA store. This interface defines the contract for requests that create new authorization stores in OpenFGA. A store is an isolated container for authorization data, including relationship tuples, authorization models, and configuration. Each store provides: - Complete isolation of authorization data from other stores - Independent versioning of authorization models - Separate configuration and access controls - Dedicated API endpoints for all operations Creating a store establishes a new authorization domain where you can define relationship models, write authorization tuples, and perform permission checks. The store name serves as a human-readable identifier for administrative purposes.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getName()`](#getname)
- [`getRequest()`](#getrequest)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateStoreRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [CreateStoreResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/CreateStoreResponseInterface.md) (response)
- [CreateStoreRequest](https://github.com/evansims/openfga-php/blob/main/Requests/CreateStoreRequest.md) (implementation)
#### Methods
##### getName
```php
public function getName(): string
```
Get the name for the new store. Returns the human-readable name that will be assigned to the new store. This name is used for identification and administrative purposes and should be descriptive enough to distinguish the store from others in your organization. The store name: - Must be a non-empty string - Should be descriptive and meaningful for administrative purposes - Is used for display in management interfaces and logging - Does not need to be globally unique (the store ID serves that purpose)
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/CreateStoreRequestInterface.php#L45)
###### Returns
`string` — The descriptive name for the new authorization store
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
<!-- End of evansims/openfga-php/docs/API/Requests/CreateStoreRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/DeleteStoreRequest.md -->
### DeleteStoreRequest
Request for permanently deleting a store and all its data. This request removes the entire store, including all authorization models, relationship tuples, and associated metadata. This operation is irreversible and should be used with extreme caution in production environments.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/DeleteStoreRequest.php)
#### Implements
- [`DeleteStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/DeleteStoreRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [DeleteStoreResponse](https://github.com/evansims/openfga-php/blob/main/Responses/DeleteStoreResponse.md) (response)
- [DeleteStoreRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/DeleteStoreRequestInterface.md) (interface)
#### Methods
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/DeleteStoreRequest.php#L49)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the ID of the store to delete. Returns the unique identifier of the store that will be permanently removed from OpenFGA. This operation will delete all data associated with the store, including relationship tuples, authorization models, and configuration settings. Important:** This is a destructive operation that cannot be reversed. Ensure you have the correct store ID and proper authorization before proceeding with the deletion.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/DeleteStoreRequest.php#L61)
###### Returns
`string` — The unique identifier of the store to permanently delete
<!-- End of evansims/openfga-php/docs/API/Requests/DeleteStoreRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/DeleteStoreRequestInterface.md -->
### DeleteStoreRequestInterface
Interface for deleting an OpenFGA store. This interface defines the contract for requests that permanently remove an authorization store from OpenFGA. Deleting a store is an irreversible operation that removes all associated data including relationship tuples, authorization models, assertions, and configuration. Store deletion is typically used for: - Cleaning up test or development environments - Removing stores for discontinued projects or applications - Implementing data retention policies and compliance requirements - Freeing up resources and reducing storage costs Warning:** This operation is permanent and cannot be undone. All authorization data within the store will be lost, including relationship tuples, authorization models, and any custom configurations. Ensure you have proper backups and authorization before performing this operation.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/DeleteStoreRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [DeleteStoreResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/DeleteStoreResponseInterface.md) (response)
- [DeleteStoreRequest](https://github.com/evansims/openfga-php/blob/main/Requests/DeleteStoreRequest.md) (implementation)
#### Methods
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the ID of the store to delete. Returns the unique identifier of the store that will be permanently removed from OpenFGA. This operation will delete all data associated with the store, including relationship tuples, authorization models, and configuration settings. Important:** This is a destructive operation that cannot be reversed. Ensure you have the correct store ID and proper authorization before proceeding with the deletion.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/DeleteStoreRequestInterface.php#L45)
###### Returns
`string` — The unique identifier of the store to permanently delete
<!-- End of evansims/openfga-php/docs/API/Requests/DeleteStoreRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ExpandRequest.md -->
### ExpandRequest
Request for expanding a relationship to show all users who have that relationship. This request returns the complete set of users and usersets that have the specified relationship with an object. It's useful for debugging authorization models, auditing permissions, and understanding the complete authorization tree.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getTupleKey()`](#gettuplekey)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequest.php)
#### Implements
- [`ExpandRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ExpandRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ExpandResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ExpandResponse.md) (response)
- [ExpandRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ExpandRequestInterface.md) (interface)
#### Methods
##### getConsistency
```php
public function getConsistency(): ?OpenFGA\Models\Enums\Consistency
```
Get the read consistency level for the expand operation. Determines the consistency guarantees for reading authorization data during the expansion. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequest.php#L63)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get additional tuples to consider during the expansion. Returns a collection of temporary relationship tuples that are added to the authorization data during evaluation. This allows you to test how hypothetical or pending relationship changes would affect the authorization graph without permanently modifying the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequest.php#L72)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getModel
```php
public function getModel(): ?string
```
Get the authorization model ID to use for the expansion. Specifies which version of the authorization model should be used when expanding the relationship graph. Using a specific model ID ensures consistent results even when the model is being updated. If not specified, the latest model version will be used.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequest.php#L81)
###### Returns
`string` | `null` — The authorization model ID for evaluation, or null to use the latest model version
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequest.php#L92)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. Identifies which OpenFGA store contains the relationship tuples and configuration to use for the expansion. All evaluation will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequest.php#L116)
###### Returns
`string` — The store ID containing the authorization data
##### getTupleKey
```php
public function getTupleKey(): OpenFGA\Models\TupleKeyInterface
```
Get the relationship tuple to expand. Specifies the starting point for the relationship expansion. This defines the object and relation for which the authorization graph should be expanded. The expansion will show all users and user sets that have the specified relation to the specified object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequest.php#L125)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) — The relationship tuple specifying what to expand (object and relation)
<!-- End of evansims/openfga-php/docs/API/Requests/ExpandRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ExpandRequestInterface.md -->
### ExpandRequestInterface
Interface for expanding relationship graphs in OpenFGA. This interface defines the contract for requests that expand authorization relationships to show the complete graph of users that have access to a resource through various relationship paths. The expand operation traces all possible authorization paths and returns a tree structure showing how permissions are derived. Expand operations are particularly useful for: - Understanding complex authorization chains and inheritance - Debugging permission issues and unexpected access grants - Auditing who has access to sensitive resources and why - Visualizing the authorization graph for administrative purposes - Analyzing the impact of relationship changes before applying them The expansion can include direct relationships, inherited permissions, and computed relationships through complex authorization model rules.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getTupleKey()`](#gettuplekey)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ExpandResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ExpandResponseInterface.md) (response)
- [ExpandRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ExpandRequest.md) (implementation)
#### Methods
##### getConsistency
```php
public function getConsistency(): Consistency|null
```
Get the read consistency level for the expand operation. Determines the consistency guarantees for reading authorization data during the expansion. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequestInterface.php#L46)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContextualTuples
```php
public function getContextualTuples(): TupleKeysInterface|null
```
Get additional tuples to consider during the expansion. Returns a collection of temporary relationship tuples that are added to the authorization data during evaluation. This allows you to test how hypothetical or pending relationship changes would affect the authorization graph without permanently modifying the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequestInterface.php#L58)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getModel
```php
public function getModel(): string|null
```
Get the authorization model ID to use for the expansion. Specifies which version of the authorization model should be used when expanding the relationship graph. Using a specific model ID ensures consistent results even when the model is being updated. If not specified, the latest model version will be used.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequestInterface.php#L70)
###### Returns
`string` | `null` — The authorization model ID for evaluation, or null to use the latest model version
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. Identifies which OpenFGA store contains the relationship tuples and configuration to use for the expansion. All evaluation will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequestInterface.php#L81)
###### Returns
`string` — The store ID containing the authorization data
##### getTupleKey
```php
public function getTupleKey(): TupleKeyInterface
```
Get the relationship tuple to expand. Specifies the starting point for the relationship expansion. This defines the object and relation for which the authorization graph should be expanded. The expansion will show all users and user sets that have the specified relation to the specified object.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ExpandRequestInterface.php#L93)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) — The relationship tuple specifying what to expand (object and relation)
<!-- End of evansims/openfga-php/docs/API/Requests/ExpandRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/GetAuthorizationModelRequest.md -->
### GetAuthorizationModelRequest
Request for retrieving a specific authorization model by its ID. This request fetches the complete definition of an authorization model, including all type definitions, relations, and conditions. It's useful for inspecting model configurations, debugging, and model management.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetAuthorizationModelRequest.php)
#### Implements
- [`GetAuthorizationModelRequestInterface`](https://github.com/evansims/openfga-php/blob/main/GetAuthorizationModelRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [GetAuthorizationModelResponse](https://github.com/evansims/openfga-php/blob/main/Responses/GetAuthorizationModelResponse.md) (response)
- [GetAuthorizationModelRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/GetAuthorizationModelRequestInterface.md) (interface)
#### Methods
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to retrieve. Specifies which version of the authorization model should be fetched from the store. Each model has a unique identifier that allows you to retrieve specific versions even as new models are created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetAuthorizationModelRequest.php#L55)
###### Returns
`string` — The unique identifier of the authorization model to retrieve
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetAuthorizationModelRequest.php#L64)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization model. Identifies which OpenFGA store contains the authorization model to retrieve. Each store can contain multiple model versions, and this specifies which store context to search within.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetAuthorizationModelRequest.php#L76)
###### Returns
`string` — The store ID containing the authorization model to retrieve
<!-- End of evansims/openfga-php/docs/API/Requests/GetAuthorizationModelRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/GetAuthorizationModelRequestInterface.md -->
### GetAuthorizationModelRequestInterface
Interface for retrieving a specific authorization model. This interface defines the contract for requests that fetch a complete authorization model from an OpenFGA store. Authorization models define the relationship types, object types, and access control rules that govern permission evaluation in your application. Retrieving authorization models is essential for: - Inspecting current authorization schema and rules - Building administrative interfaces for model management - Implementing model comparison and diff functionality - Backing up and versioning authorization configurations - Understanding inheritance and relationship patterns - Debugging authorization behavior and rule conflicts The retrieved model includes all type definitions, conditions, and schema information needed to understand how permissions are evaluated.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetAuthorizationModelRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [GetAuthorizationModelResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/GetAuthorizationModelResponseInterface.md) (response)
- [GetAuthorizationModelRequest](https://github.com/evansims/openfga-php/blob/main/Requests/GetAuthorizationModelRequest.md) (implementation)
#### Methods
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to retrieve. Specifies which version of the authorization model should be fetched from the store. Each model has a unique identifier that allows you to retrieve specific versions even as new models are created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetAuthorizationModelRequestInterface.php#L40)
###### Returns
`string` — The unique identifier of the authorization model to retrieve
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization model. Identifies which OpenFGA store contains the authorization model to retrieve. Each store can contain multiple model versions, and this specifies which store context to search within.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetAuthorizationModelRequestInterface.php#L51)
###### Returns
`string` — The store ID containing the authorization model to retrieve
<!-- End of evansims/openfga-php/docs/API/Requests/GetAuthorizationModelRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/GetStoreRequest.md -->
### GetStoreRequest
Request for retrieving store information by its ID. This request fetches the details of a specific store, including its name and metadata. It's useful for store management, displaying store information, and validating store existence before performing operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetStoreRequest.php)
#### Implements
- [`GetStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/GetStoreRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [GetStoreResponse](https://github.com/evansims/openfga-php/blob/main/Responses/GetStoreResponse.md) (response)
- [GetStoreRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/GetStoreRequestInterface.md) (interface)
#### Methods
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetStoreRequest.php#L49)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the ID of the store to retrieve. Returns the unique identifier of the store whose information should be fetched. This will return metadata about the store including its name, creation timestamp, and other administrative details.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetStoreRequest.php#L61)
###### Returns
`string` — The unique identifier of the store to retrieve information for
<!-- End of evansims/openfga-php/docs/API/Requests/GetStoreRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/GetStoreRequestInterface.md -->
### GetStoreRequestInterface
Interface for retrieving information about an OpenFGA store. This interface defines the contract for requests that fetch metadata and configuration information for a specific OpenFGA store. Store information includes details such as the store name, creation time, and other administrative metadata. Getting store information is useful for: - Administrative interfaces and dashboards - Verifying store existence before performing operations - Displaying store metadata to users - Auditing and monitoring store usage - Implementing store management workflows
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetStoreRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [GetStoreResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/GetStoreResponseInterface.md) (response)
- [GetStoreRequest](https://github.com/evansims/openfga-php/blob/main/Requests/GetStoreRequest.md) (implementation)
#### Methods
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the ID of the store to retrieve. Returns the unique identifier of the store whose information should be fetched. This will return metadata about the store including its name, creation timestamp, and other administrative details.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/GetStoreRequestInterface.php#L36)
###### Returns
`string` — The unique identifier of the store to retrieve information for
<!-- End of evansims/openfga-php/docs/API/Requests/GetStoreRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListAuthorizationModelsRequest.md -->
### ListAuthorizationModelsRequest
Request for listing all authorization models in a store. This request retrieves a paginated list of authorization models, including their IDs and metadata. It's useful for browsing available models, model management interfaces, and selecting models for operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequest.php)
#### Implements
- [`ListAuthorizationModelsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ListAuthorizationModelsRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListAuthorizationModelsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListAuthorizationModelsResponse.md) (response)
- [ListAuthorizationModelsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListAuthorizationModelsRequestInterface.md) (interface)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for paginated results. Returns the pagination token from a previous list models operation to continue retrieving results from where the last request left off. This enables efficient pagination through stores with many model versions without missing or duplicating entries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequest.php#L53)
###### Returns
`string` | `null` — The continuation token from a previous operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): ?int
```
Get the maximum number of models to return per page. Specifies the page size for paginated results. This controls how many authorization models are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed to retrieve all model versions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequest.php#L62)
###### Returns
`int` | `null` — The maximum number of models to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequest.php#L71)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization models to list. Identifies which OpenFGA store contains the authorization models to enumerate. Each store maintains its own independent collection of model versions, representing the evolution of that store's authorization schema over time.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequest.php#L90)
###### Returns
`string` — The store ID containing the authorization models to list
<!-- End of evansims/openfga-php/docs/API/Requests/ListAuthorizationModelsRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListAuthorizationModelsRequestInterface.md -->
### ListAuthorizationModelsRequestInterface
Interface for listing authorization models in a store. This interface defines the contract for requests that retrieve a paginated list of all authorization model versions within a specific OpenFGA store. Authorization models are versioned, and this operation allows you to browse through the evolution of your authorization schema over time. Listing authorization models is useful for: - Administrative interfaces showing model version history - Implementing model rollback and comparison functionality - Auditing changes to authorization schemas over time - Building deployment and migration tools for authorization models - Understanding the evolution of permission structures - Debugging authorization issues by examining model versions Each model in the list includes metadata such as creation time and model ID, allowing you to understand when changes were made and select specific versions for detailed inspection or operational use.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListAuthorizationModelsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListAuthorizationModelsResponseInterface.md) (response)
- [ListAuthorizationModelsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListAuthorizationModelsRequest.md) (implementation)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for paginated results. Returns the pagination token from a previous list models operation to continue retrieving results from where the last request left off. This enables efficient pagination through stores with many model versions without missing or duplicating entries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequestInterface.php#L42)
###### Returns
`string` | `null` — The continuation token from a previous operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): int|null
```
Get the maximum number of models to return per page. Specifies the page size for paginated results. This controls how many authorization models are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed to retrieve all model versions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequestInterface.php#L54)
###### Returns
`int` | `null` — The maximum number of models to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization models to list. Identifies which OpenFGA store contains the authorization models to enumerate. Each store maintains its own independent collection of model versions, representing the evolution of that store's authorization schema over time.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListAuthorizationModelsRequestInterface.php#L66)
###### Returns
`string` — The store ID containing the authorization models to list
<!-- End of evansims/openfga-php/docs/API/Requests/ListAuthorizationModelsRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListObjectsRequest.md -->
### ListObjectsRequest
Request for listing objects that a user has a specific relationship with. This request finds all objects of a given type where the specified user has the requested relationship. It's useful for building resource lists, dashboards, or any interface that shows what a user can access.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getRelation()`](#getrelation)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getType()`](#gettype)
- [`getUser()`](#getuser)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php)
#### Implements
- [`ListObjectsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ListObjectsRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListObjectsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListObjectsResponse.md) (response)
- [ListObjectsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListObjectsRequestInterface.md) (interface)
#### Methods
##### getConsistency
```php
public function getConsistency(): ?OpenFGA\Models\Enums\Consistency
```
Get the read consistency level for the list operation. Determines the consistency guarantees for reading authorization data during the list operation. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L84)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContext
```php
public function getContext(): ?object
```
Get additional context data for conditional evaluation. Provides contextual information that can be used in conditional expressions within the authorization model. This enables dynamic permission evaluation based on runtime data such as time-based access, location restrictions, or resource attributes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L93)
###### Returns
`object` | `null` — The context object containing additional data for evaluation, or null if no context is provided
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get additional tuples to consider during the list operation. Returns a collection of temporary relationship tuples that are added to the authorization data during evaluation. This allows you to test access scenarios with hypothetical or pending relationship changes without permanently modifying the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L102)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getModel
```php
public function getModel(): ?string
```
Get the authorization model ID to use for the list operation. Specifies which version of the authorization model should be used when evaluating object access. Using a specific model ID ensures consistent results even when the model is being updated. If not specified, the latest model version will be used.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L111)
###### Returns
`string` | `null` — The authorization model ID for evaluation, or null to use the latest model version
##### getRelation
```php
public function getRelation(): string
```
Get the relation to check for object access. Specifies the relationship type to evaluate when determining object access. For example, "can_view," "can_edit," or "owner." This defines what type of permission or relationship is being queried.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L120)
###### Returns
`string` — The relation name to check for object access
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L131)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. Identifies which OpenFGA store contains the relationship tuples and configuration to use for the list operation. All evaluation will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L158)
###### Returns
`string` — The store ID containing the authorization data
##### getType
```php
public function getType(): string
```
Get the object type to filter results by. Specifies the type of objects to include in the results. Only objects of this type will be considered when determining what the user can access. For example, "document," "folder," or "repository."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L167)
###### Returns
`string` — The object type to filter results by
##### getUser
```php
public function getUser(): string
```
Get the user to check object access for. Identifies the user for whom object access is being evaluated. This can be a direct user identifier or a userset expression. The operation will return all objects of the specified type that this user can access through the specified relation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequest.php#L176)
###### Returns
`string` — The user identifier or userset to check object access for
<!-- End of evansims/openfga-php/docs/API/Requests/ListObjectsRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListObjectsRequestInterface.md -->
### ListObjectsRequestInterface
Interface for listing objects that a user has access to. This interface defines the contract for requests that query which objects a specific user can access for a given relation. This is the inverse of a permission check - instead of asking "can this user access this object?", it asks "what objects can this user access?" List objects operations support: - Filtering by object type and relation - Contextual evaluation with additional data - Temporary relationship tuples for scenario testing - Configurable read consistency levels - Authorization model versioning for consistent results This is particularly useful for building user interfaces that need to display only the resources a user can access, such as file listings, document repositories, or administrative dashboards.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getRelation()`](#getrelation)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getType()`](#gettype)
- [`getUser()`](#getuser)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListObjectsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListObjectsResponseInterface.md) (response)
- [ListObjectsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListObjectsRequest.md) (implementation)
#### Methods
##### getConsistency
```php
public function getConsistency(): Consistency|null
```
Get the read consistency level for the list operation. Determines the consistency guarantees for reading authorization data during the list operation. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L46)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContext
```php
public function getContext(): object|null
```
Get additional context data for conditional evaluation. Provides contextual information that can be used in conditional expressions within the authorization model. This enables dynamic permission evaluation based on runtime data such as time-based access, location restrictions, or resource attributes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L58)
###### Returns
`object` | `null` — The context object containing additional data for evaluation, or null if no context is provided
##### getContextualTuples
```php
public function getContextualTuples(): TupleKeysInterface|null
```
Get additional tuples to consider during the list operation. Returns a collection of temporary relationship tuples that are added to the authorization data during evaluation. This allows you to test access scenarios with hypothetical or pending relationship changes without permanently modifying the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L70)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getModel
```php
public function getModel(): string|null
```
Get the authorization model ID to use for the list operation. Specifies which version of the authorization model should be used when evaluating object access. Using a specific model ID ensures consistent results even when the model is being updated. If not specified, the latest model version will be used.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L82)
###### Returns
`string` | `null` — The authorization model ID for evaluation, or null to use the latest model version
##### getRelation
```php
public function getRelation(): string
```
Get the relation to check for object access. Specifies the relationship type to evaluate when determining object access. For example, "can_view," "can_edit," or "owner." This defines what type of permission or relationship is being queried.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L93)
###### Returns
`string` — The relation name to check for object access
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. Identifies which OpenFGA store contains the relationship tuples and configuration to use for the list operation. All evaluation will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L104)
###### Returns
`string` — The store ID containing the authorization data
##### getType
```php
public function getType(): string
```
Get the object type to filter results by. Specifies the type of objects to include in the results. Only objects of this type will be considered when determining what the user can access. For example, "document," "folder," or "repository."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L115)
###### Returns
`string` — The object type to filter results by
##### getUser
```php
public function getUser(): string
```
Get the user to check object access for. Identifies the user for whom object access is being evaluated. This can be a direct user identifier or a userset expression. The operation will return all objects of the specified type that this user can access through the specified relation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListObjectsRequestInterface.php#L127)
###### Returns
`string` — The user identifier or userset to check object access for
<!-- End of evansims/openfga-php/docs/API/Requests/ListObjectsRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListStoresRequest.md -->
### ListStoresRequest
Request for listing all available stores with pagination support. This request retrieves a paginated list of stores accessible to the authenticated user or application. It's useful for store selection interfaces, administrative dashboards, and multi-tenant applications.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListStoresRequest.php)
#### Implements
- [`ListStoresRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ListStoresRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListStoresResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListStoresResponse.md) (response)
- [ListStoresRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListStoresRequestInterface.md) (interface)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for paginated results. Returns the pagination token from a previous list stores operation to continue retrieving results from where the last request left off. This enables efficient pagination through large numbers of stores without missing or duplicating entries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListStoresRequest.php#L51)
###### Returns
`string` | `null` — The continuation token from a previous operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): ?int
```
Get the maximum number of stores to return per page. Specifies the page size for paginated results. This controls how many stores are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed to retrieve all stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListStoresRequest.php#L60)
###### Returns
`int` | `null` — The maximum number of stores to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListStoresRequest.php#L69)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
<!-- End of evansims/openfga-php/docs/API/Requests/ListStoresRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListStoresRequestInterface.md -->
### ListStoresRequestInterface
Interface for listing available OpenFGA stores. This interface defines the contract for requests that retrieve a paginated list of all OpenFGA stores accessible to the current authentication context. This is typically used for administrative purposes, allowing users to browse and manage multiple authorization domains. Store listing is essential for: - Administrative dashboards and management interfaces - Store discovery and selection workflows - Monitoring and auditing store usage across an organization - Implementing multi-tenant authorization architectures - Backup and migration tooling that needs to enumerate stores The operation supports pagination to handle large numbers of stores efficiently, ensuring good performance even in environments with hundreds or thousands of authorization domains.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListStoresRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListStoresResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListStoresResponseInterface.md) (response)
- [ListStoresRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListStoresRequest.md) (implementation)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for paginated results. Returns the pagination token from a previous list stores operation to continue retrieving results from where the last request left off. This enables efficient pagination through large numbers of stores without missing or duplicating entries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListStoresRequestInterface.php#L41)
###### Returns
`string` | `null` — The continuation token from a previous operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): int|null
```
Get the maximum number of stores to return per page. Specifies the page size for paginated results. This controls how many stores are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed to retrieve all stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListStoresRequestInterface.php#L53)
###### Returns
`int` | `null` — The maximum number of stores to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
<!-- End of evansims/openfga-php/docs/API/Requests/ListStoresRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListTupleChangesRequest.md -->
### ListTupleChangesRequest
Request for listing changes to relationship tuples over time. This request retrieves a chronological list of tuple modifications (creates, updates, deletes) within a store. It's essential for auditing, change tracking, and building event-driven authorization systems that react to permission changes.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
- [`getStartTime()`](#getstarttime)
- [`getStore()`](#getstore)
- [`getType()`](#gettype)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequest.php)
#### Implements
- [`ListTupleChangesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ListTupleChangesRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListTupleChangesResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListTupleChangesResponse.md) (response)
- [ListTupleChangesRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListTupleChangesRequestInterface.md) (interface)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for paginated results. Returns the pagination token from a previous list changes operation to continue retrieving results from where the last request left off. This enables efficient pagination through large change histories without missing or duplicating entries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequest.php#L64)
###### Returns
`string` | `null` — The continuation token from a previous operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): ?int
```
Get the maximum number of changes to return per page. Specifies the page size for paginated results. This controls how many change entries are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed for extensive change histories.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequest.php#L73)
###### Returns
`int` | `null` — The maximum number of changes to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequest.php#L82)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStartTime
```php
public function getStartTime(): ?DateTimeImmutable
```
Get the earliest time to include in the change history. Specifies the starting point for the time range of changes to retrieve. Only changes that occurred at or after this time will be included in the results. This allows you to focus on recent changes or specific time periods of interest.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequest.php#L103)
###### Returns
`DateTimeImmutable` | `null` — The earliest timestamp to include in results, or null to include all changes from the beginning
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the tuple changes to list. Identifies which OpenFGA store contains the change history to query. Each store maintains its own independent change log, ensuring complete isolation of audit trails between different authorization domains.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequest.php#L112)
###### Returns
`string` — The store ID containing the tuple change history to retrieve
##### getType
```php
public function getType(): ?string
```
Get the object type filter for changes. Specifies an optional filter to only include changes affecting tuples of a specific object type. This helps narrow the results to changes relevant to particular resource types, such as "document," "folder," or "organization."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequest.php#L121)
###### Returns
`string` | `null` — The object type to filter changes by, or null to include changes for all object types
<!-- End of evansims/openfga-php/docs/API/Requests/ListTupleChangesRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListTupleChangesRequestInterface.md -->
### ListTupleChangesRequestInterface
Interface for listing historical changes to relationship tuples. This interface defines the contract for requests that query the change history of relationship tuples within an OpenFGA store. It provides a chronological audit trail of all tuple modifications, including writes and deletes, allowing you to track how relationships have evolved over time. Tuple change history is essential for: - **Auditing**: Track who made changes and when for compliance - **Debugging**: Understand how authorization state reached its current condition - **Synchronization**: Keep external systems in sync with authorization changes - **Analytics**: Analyze access patterns and permission trends over time - **Rollback**: Understand what changes need to be reversed The operation supports: - Time-based filtering to focus on specific periods - Object type filtering to track changes for specific resource types - Pagination for handling large change histories efficiently - Chronological ordering to understand the sequence of changes Each change entry includes the tuple that was modified, the type of operation (write or delete), and the timestamp when the change occurred.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
- [`getStartTime()`](#getstarttime)
- [`getStore()`](#getstore)
- [`getType()`](#gettype)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListTupleChangesResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListTupleChangesResponseInterface.md) (response)
- [ListTupleChangesRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListTupleChangesRequest.md) (implementation)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for paginated results. Returns the pagination token from a previous list changes operation to continue retrieving results from where the last request left off. This enables efficient pagination through large change histories without missing or duplicating entries.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequestInterface.php#L48)
###### Returns
`string` | `null` — The continuation token from a previous operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): int|null
```
Get the maximum number of changes to return per page. Specifies the page size for paginated results. This controls how many change entries are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed for extensive change histories.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequestInterface.php#L60)
###### Returns
`int` | `null` — The maximum number of changes to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStartTime
```php
public function getStartTime(): DateTimeImmutable|null
```
Get the earliest time to include in the change history. Specifies the starting point for the time range of changes to retrieve. Only changes that occurred at or after this time will be included in the results. This allows you to focus on recent changes or specific time periods of interest.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequestInterface.php#L72)
###### Returns
`DateTimeImmutable` | `null` — The earliest timestamp to include in results, or null to include all changes from the beginning
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the tuple changes to list. Identifies which OpenFGA store contains the change history to query. Each store maintains its own independent change log, ensuring complete isolation of audit trails between different authorization domains.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequestInterface.php#L83)
###### Returns
`string` — The store ID containing the tuple change history to retrieve
##### getType
```php
public function getType(): string|null
```
Get the object type filter for changes. Specifies an optional filter to only include changes affecting tuples of a specific object type. This helps narrow the results to changes relevant to particular resource types, such as "document," "folder," or "organization."
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListTupleChangesRequestInterface.php#L95)
###### Returns
`string` | `null` — The object type to filter changes by, or null to include changes for all object types
<!-- End of evansims/openfga-php/docs/API/Requests/ListTupleChangesRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListUsersRequest.md -->
### ListUsersRequest
Request for listing users who have a specific relationship with an object. This request finds all users (or usersets) that have the specified relationship with a given object, filtered by user type. It's useful for building access management interfaces, member lists, and permission auditing tools.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getUserFilters()`](#getuserfilters)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php)
#### Implements
- [`ListUsersRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ListUsersRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListUsersResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListUsersResponse.md) (response)
- [ListUsersRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListUsersRequestInterface.md) (interface)
#### Methods
##### getConsistency
```php
public function getConsistency(): ?OpenFGA\Models\Enums\Consistency
```
Get the read consistency level for the list operation. Determines the consistency guarantees for reading authorization data during the user listing operation. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L81)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContext
```php
public function getContext(): ?object
```
Get additional context data for conditional evaluation. Provides contextual information that can be used in conditional expressions within the authorization model. This enables dynamic permission evaluation based on runtime data such as time-based access, location restrictions, or resource attributes when determining user access.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L90)
###### Returns
`object` | `null` — The context object containing additional data for evaluation, or null if no context is provided
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get additional tuples to consider during the list operation. Returns a collection of temporary relationship tuples that are added to the authorization data during evaluation. This allows you to test access scenarios with hypothetical or pending relationship changes without permanently modifying the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L99)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to use for the list operation. Specifies which version of the authorization model should be used when evaluating user access. Using a specific model ID ensures consistent results even when the model is being updated.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L108)
###### Returns
`string` — The authorization model ID for evaluating user relationships
##### getObject
```php
public function getObject(): string
```
Get the object to list users for. Specifies the target object for which users will be listed. This identifies the specific resource, document, or entity for which you want to know which users have the specified relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L117)
###### Returns
`string` — The object identifier to list users for
##### getRelation
```php
public function getRelation(): string
```
Get the relation to check for user access. Specifies the relationship type to evaluate when determining which users have access to the object. For example, "owner," "editor," "viewer," or "member." This defines what type of permission or relationship is being queried.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L126)
###### Returns
`string` — The relation name to check for user access
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L137)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. Identifies which OpenFGA store contains the relationship tuples and configuration to use for the list operation. All evaluation will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L171)
###### Returns
`string` — The store ID containing the authorization data
##### getUserFilters
```php
public function getUserFilters(): OpenFGA\Models\Collections\UserTypeFiltersInterface
```
Get the user type filters to apply to results. Returns a collection of filters that control which types of users are included in the results. This allows you to narrow the scope of the query to specific user types, such as individual users, groups, or service accounts, based on your application's needs. User filters help optimize performance and focus results by excluding user types that are not relevant to the current operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequest.php#L180)
###### Returns
[`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UserTypeFiltersInterface.md) — Collection of user type filters to apply to the results
<!-- End of evansims/openfga-php/docs/API/Requests/ListUsersRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ListUsersRequestInterface.md -->
### ListUsersRequestInterface
Interface for listing users who have a specific relation to an object. This interface defines the contract for requests that query which users have a specific relationship to a given object. This is similar to the expand operation but focuses specifically on returning the users rather than the complete relationship graph structure. List users operations are particularly useful for: - Building user interfaces that show who has access to a resource - Implementing sharing and collaboration features - Auditing and compliance reporting for access control - Sending notifications to users with specific permissions - Managing team membership and role assignments The operation supports: - Filtering by user types to control result scope - Contextual evaluation with additional runtime data - Temporary relationship tuples for scenario testing - Configurable read consistency levels for performance optimization - Authorization model versioning for consistent results This provides the inverse perspective to list objects - instead of asking "what can this user access?," it asks "who can access this object?"
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getObject()`](#getobject)
- [`getRelation()`](#getrelation)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getUserFilters()`](#getuserfilters)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ListUsersResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListUsersResponseInterface.md) (response)
- [ListUsersRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListUsersRequest.md) (implementation)
#### Methods
##### getConsistency
```php
public function getConsistency(): Consistency|null
```
Get the read consistency level for the list operation. Determines the consistency guarantees for reading authorization data during the user listing operation. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L55)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContext
```php
public function getContext(): object|null
```
Get additional context data for conditional evaluation. Provides contextual information that can be used in conditional expressions within the authorization model. This enables dynamic permission evaluation based on runtime data such as time-based access, location restrictions, or resource attributes when determining user access.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L67)
###### Returns
`object` | `null` — The context object containing additional data for evaluation, or null if no context is provided
##### getContextualTuples
```php
public function getContextualTuples(): TupleKeysInterface|null
```
Get additional tuples to consider during the list operation. Returns a collection of temporary relationship tuples that are added to the authorization data during evaluation. This allows you to test access scenarios with hypothetical or pending relationship changes without permanently modifying the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L79)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Additional relationship tuples for evaluation, or null if none provided
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to use for the list operation. Specifies which version of the authorization model should be used when evaluating user access. Using a specific model ID ensures consistent results even when the model is being updated.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L90)
###### Returns
`string` — The authorization model ID for evaluating user relationships
##### getObject
```php
public function getObject(): string
```
Get the object to list users for. Specifies the target object for which users will be listed. This identifies the specific resource, document, or entity for which you want to know which users have the specified relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L101)
###### Returns
`string` — The object identifier to list users for
##### getRelation
```php
public function getRelation(): string
```
Get the relation to check for user access. Specifies the relationship type to evaluate when determining which users have access to the object. For example, "owner," "editor," "viewer," or "member." This defines what type of permission or relationship is being queried.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L113)
###### Returns
`string` — The relation name to check for user access
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the authorization data. Identifies which OpenFGA store contains the relationship tuples and configuration to use for the list operation. All evaluation will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L124)
###### Returns
`string` — The store ID containing the authorization data
##### getUserFilters
```php
public function getUserFilters(): UserTypeFiltersInterface
```
Get the user type filters to apply to results. Returns a collection of filters that control which types of users are included in the results. This allows you to narrow the scope of the query to specific user types, such as individual users, groups, or service accounts, based on your application's needs. User filters help optimize performance and focus results by excluding user types that are not relevant to the current operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ListUsersRequestInterface.php#L139)
###### Returns
[`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UserTypeFiltersInterface.md) — Collection of user type filters to apply to the results
<!-- End of evansims/openfga-php/docs/API/Requests/ListUsersRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/README.md -->
## Requests
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Requests
Request objects for all OpenFGA API operations.
**Total Components:** 37
### Interfaces
| Name | Description |
|------|-------------|
| [`BatchCheckRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckRequestInterface.md) | Request for performing multiple authorization checks in a single batch. This request allows check... |
| [`CheckRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./CheckRequestInterface.md) | Interface for authorization check request specifications. This interface defines the contract for... |
| [`CreateAuthorizationModelRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./CreateAuthorizationModelRequestInterface.md) | Interface for creating new authorization models in OpenFGA. This interface defines the contract f... |
| [`CreateStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./CreateStoreRequestInterface.md) | Interface for creating a new OpenFGA store. This interface defines the contract for requests that... |
| [`DeleteStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./DeleteStoreRequestInterface.md) | Interface for deleting an OpenFGA store. This interface defines the contract for requests that pe... |
| [`ExpandRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ExpandRequestInterface.md) | Interface for expanding relationship graphs in OpenFGA. This interface defines the contract for r... |
| [`GetAuthorizationModelRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./GetAuthorizationModelRequestInterface.md) | Interface for retrieving a specific authorization model. This interface defines the contract for ... |
| [`GetStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./GetStoreRequestInterface.md) | Interface for retrieving information about an OpenFGA store. This interface defines the contract ... |
| [`ListAuthorizationModelsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ListAuthorizationModelsRequestInterface.md) | Interface for listing authorization models in a store. This interface defines the contract for re... |
| [`ListObjectsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ListObjectsRequestInterface.md) | Interface for listing objects that a user has access to. This interface defines the contract for ... |
| [`ListStoresRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ListStoresRequestInterface.md) | Interface for listing available OpenFGA stores. This interface defines the contract for requests ... |
| [`ListTupleChangesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ListTupleChangesRequestInterface.md) | Interface for listing historical changes to relationship tuples. This interface defines the contr... |
| [`ListUsersRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ListUsersRequestInterface.md) | Interface for listing users who have a specific relation to an object. This interface defines the... |
| [`ReadAssertionsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ReadAssertionsRequestInterface.md) | Interface for reading test assertions from an authorization model. This interface defines the con... |
| [`ReadTuplesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./ReadTuplesRequestInterface.md) | Interface for reading relationship tuples from an OpenFGA store. This interface defines the contr... |
| [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/./RequestInterface.md) | Base interface for all OpenFGA API request objects. This interface defines the core contract that... |
| [`StreamedListObjectsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./StreamedListObjectsRequestInterface.md) | Request interface for streaming objects that a user has a specific relationship with. This reques... |
| [`WriteAssertionsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./WriteAssertionsRequestInterface.md) | Interface for writing test assertions to an authorization model. This interface defines the contr... |
| [`WriteTuplesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./WriteTuplesRequestInterface.md) | Interface for writing relationship tuples to an OpenFGA store. This interface defines the contrac... |
### Classes
| Name | Description |
|------|-------------|
| [`BatchCheckRequest`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckRequest.md) | Request for performing multiple authorization checks in a single batch. This request allows check... |
| [`CheckRequest`](https://github.com/evansims/openfga-php/blob/main/./CheckRequest.md) | Request for performing authorization checks in OpenFGA. This request determines whether a user ha... |
| [`CreateAuthorizationModelRequest`](https://github.com/evansims/openfga-php/blob/main/./CreateAuthorizationModelRequest.md) | Request for creating a new authorization model in OpenFGA. Authorization models define the permis... |
| [`CreateStoreRequest`](https://github.com/evansims/openfga-php/blob/main/./CreateStoreRequest.md) | Request for creating a new OpenFGA store. Stores provide data isolation for different application... |
| [`DeleteStoreRequest`](https://github.com/evansims/openfga-php/blob/main/./DeleteStoreRequest.md) | Request for permanently deleting a store and all its data. This request removes the entire store,... |
| [`ExpandRequest`](https://github.com/evansims/openfga-php/blob/main/./ExpandRequest.md) | Request for expanding a relationship to show all users who have that relationship. This request r... |
| [`GetAuthorizationModelRequest`](https://github.com/evansims/openfga-php/blob/main/./GetAuthorizationModelRequest.md) | Request for retrieving a specific authorization model by its ID. This request fetches the complet... |
| [`GetStoreRequest`](https://github.com/evansims/openfga-php/blob/main/./GetStoreRequest.md) | Request for retrieving store information by its ID. This request fetches the details of a specifi... |
| [`ListAuthorizationModelsRequest`](https://github.com/evansims/openfga-php/blob/main/./ListAuthorizationModelsRequest.md) | Request for listing all authorization models in a store. This request retrieves a paginated list ... |
| [`ListObjectsRequest`](https://github.com/evansims/openfga-php/blob/main/./ListObjectsRequest.md) | Request for listing objects that a user has a specific relationship with. This request finds all ... |
| [`ListStoresRequest`](https://github.com/evansims/openfga-php/blob/main/./ListStoresRequest.md) | Request for listing all available stores with pagination support. This request retrieves a pagina... |
| [`ListTupleChangesRequest`](https://github.com/evansims/openfga-php/blob/main/./ListTupleChangesRequest.md) | Request for listing changes to relationship tuples over time. This request retrieves a chronologi... |
| [`ListUsersRequest`](https://github.com/evansims/openfga-php/blob/main/./ListUsersRequest.md) | Request for listing users who have a specific relationship with an object. This request finds all... |
| [`ReadAssertionsRequest`](https://github.com/evansims/openfga-php/blob/main/./ReadAssertionsRequest.md) | Request for reading test assertions associated with an authorization model. This request retrieve... |
| [`ReadTuplesRequest`](https://github.com/evansims/openfga-php/blob/main/./ReadTuplesRequest.md) | Request for reading relationship tuples that match specified criteria. This request retrieves tup... |
| [`StreamedListObjectsRequest`](https://github.com/evansims/openfga-php/blob/main/./StreamedListObjectsRequest.md) | Request for streaming objects that a user has a specific relationship with. This request finds al... |
| [`WriteAssertionsRequest`](https://github.com/evansims/openfga-php/blob/main/./WriteAssertionsRequest.md) | Request for writing test assertions to validate authorization model behavior. This request stores... |
| [`WriteTuplesRequest`](https://github.com/evansims/openfga-php/blob/main/./WriteTuplesRequest.md) | Request for writing and deleting relationship tuples in OpenFGA. This request enables batch creat... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Requests/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ReadAssertionsRequest.md -->
### ReadAssertionsRequest
Request for reading test assertions associated with an authorization model. This request retrieves the test assertions that have been defined for an authorization model. These assertions help validate model behavior and ensure authorization logic works as expected in different scenarios.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadAssertionsRequest.php)
#### Implements
- [`ReadAssertionsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ReadAssertionsRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ReadAssertionsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ReadAssertionsResponse.md) (response)
- [ReadAssertionsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ReadAssertionsRequestInterface.md) (interface)
#### Methods
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to read assertions from. Specifies which version of the authorization model should have its assertions retrieved. Assertions are tied to specific model versions, ensuring that tests remain relevant to the particular authorization schema they were designed to validate.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadAssertionsRequest.php#L55)
###### Returns
`string` — The authorization model ID whose assertions should be retrieved
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadAssertionsRequest.php#L64)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the assertions to read. Identifies which OpenFGA store contains the authorization model and its associated test assertions. Assertions are stored alongside the models they test, providing a complete testing framework within each store's context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadAssertionsRequest.php#L76)
###### Returns
`string` — The store ID containing the assertions to retrieve
<!-- End of evansims/openfga-php/docs/API/Requests/ReadAssertionsRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ReadAssertionsRequestInterface.md -->
### ReadAssertionsRequestInterface
Interface for reading test assertions from an authorization model. This interface defines the contract for requests that retrieve test assertions associated with a specific authorization model. Assertions are automated tests that verify authorization model behavior by checking specific permission scenarios against expected outcomes. Reading assertions is essential for: - **Test Execution**: Running automated tests to verify model behavior - **Model Validation**: Ensuring authorization logic works as expected - **Debugging**: Understanding test scenarios when troubleshooting issues - **Documentation**: Reviewing examples of how permissions should work - **Continuous Integration**: Automating authorization model testing - **Regression Testing**: Verifying that model changes don't break existing behavior The retrieved assertions include the test scenarios, expected outcomes, and any contextual data needed to execute the tests. This provides a complete test suite that can be run to validate the authorization model's correctness.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadAssertionsRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ReadAssertionsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ReadAssertionsResponseInterface.md) (response)
- [ReadAssertionsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ReadAssertionsRequest.md) (implementation)
#### Methods
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to read assertions from. Specifies which version of the authorization model should have its assertions retrieved. Assertions are tied to specific model versions, ensuring that tests remain relevant to the particular authorization schema they were designed to validate.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadAssertionsRequestInterface.php#L42)
###### Returns
`string` — The authorization model ID whose assertions should be retrieved
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the assertions to read. Identifies which OpenFGA store contains the authorization model and its associated test assertions. Assertions are stored alongside the models they test, providing a complete testing framework within each store's context.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadAssertionsRequestInterface.php#L54)
###### Returns
`string` — The store ID containing the assertions to retrieve
<!-- End of evansims/openfga-php/docs/API/Requests/ReadAssertionsRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ReadTuplesRequest.md -->
### ReadTuplesRequest
Request for reading relationship tuples that match specified criteria. This request retrieves tuples from a store based on filtering criteria, with support for pagination and consistency levels. It's essential for querying existing relationships, debugging authorization data, and building administrative interfaces.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getTupleKey()`](#gettuplekey)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequest.php)
#### Implements
- [`ReadTuplesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/ReadTuplesRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ReadTuplesResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ReadTuplesResponse.md) (response)
- [ReadTuplesRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ReadTuplesRequestInterface.md) (interface)
#### Methods
##### getConsistency
```php
public function getConsistency(): ?OpenFGA\Models\Enums\Consistency
```
Get the read consistency level for the read operation. Determines the consistency guarantees for reading relationship tuples. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequest.php#L71)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for paginated results. Returns the pagination token from a previous read operation to continue retrieving results from where the last request left off. This enables efficient pagination through large result sets without missing or duplicating tuples.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequest.php#L80)
###### Returns
`string` | `null` — The continuation token from a previous read operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): ?int
```
Get the maximum number of tuples to return. Specifies the page size for paginated results. This controls how many relationship tuples are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed for large datasets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequest.php#L89)
###### Returns
`int` | `null` — The maximum number of tuples to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequest.php#L100)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the tuples to read. Identifies which OpenFGA store contains the relationship tuples to query. All read operations will be performed within the context of this specific store, ensuring data isolation from other stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequest.php#L128)
###### Returns
`string` — The store ID containing the relationship tuples to read
##### getTupleKey
```php
public function getTupleKey(): OpenFGA\Models\TupleKeyInterface
```
Get the tuple key pattern for filtering results. Specifies the relationship pattern to match when reading tuples. This can include specific values for object, user, and relation, or use partial patterns with wildcards to match multiple tuples. Empty or null values in the tuple key act as wildcards.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequest.php#L137)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) — The relationship tuple pattern for filtering results
<!-- End of evansims/openfga-php/docs/API/Requests/ReadTuplesRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/ReadTuplesRequestInterface.md -->
### ReadTuplesRequestInterface
Interface for reading relationship tuples from an OpenFGA store. This interface defines the contract for requests that query relationship tuples stored in OpenFGA. It supports filtering by tuple patterns and provides pagination for handling large result sets efficiently. Read operations allow you to: - Query existing relationships using tuple key patterns - Filter by specific objects, users, or relations - Use wildcard patterns to match multiple tuples - Configure read consistency for performance optimization - Paginate through large result sets with continuation tokens This is essential for auditing permissions, syncing data to external systems, building administrative interfaces, and implementing custom authorization logic that needs to inspect the relationship graph.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getPageSize()`](#getpagesize)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getTupleKey()`](#gettuplekey)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [ReadTuplesResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ReadTuplesResponseInterface.md) (response)
- [ReadTuplesRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ReadTuplesRequest.md) (implementation)
#### Methods
##### getConsistency
```php
public function getConsistency(): Consistency|null
```
Get the read consistency level for the read operation. Determines the consistency guarantees for reading relationship tuples. This allows you to balance between read performance and data freshness based on your application's requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequestInterface.php#L43)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency level for the operation, or null to use the default consistency setting
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for paginated results. Returns the pagination token from a previous read operation to continue retrieving results from where the last request left off. This enables efficient pagination through large result sets without missing or duplicating tuples.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequestInterface.php#L55)
###### Returns
`string` | `null` — The continuation token from a previous read operation, or null for the first page
##### getPageSize
```php
public function getPageSize(): int|null
```
Get the maximum number of tuples to return. Specifies the page size for paginated results. This controls how many relationship tuples are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed for large datasets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequestInterface.php#L67)
###### Returns
`int` | `null` — The maximum number of tuples to return per page, or null to use the default page size
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID containing the tuples to read. Identifies which OpenFGA store contains the relationship tuples to query. All read operations will be performed within the context of this specific store, ensuring data isolation from other stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequestInterface.php#L78)
###### Returns
`string` — The store ID containing the relationship tuples to read
##### getTupleKey
```php
public function getTupleKey(): TupleKeyInterface
```
Get the tuple key pattern for filtering results. Specifies the relationship pattern to match when reading tuples. This can include specific values for object, user, and relation, or use partial patterns with wildcards to match multiple tuples. Empty or null values in the tuple key act as wildcards.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/ReadTuplesRequestInterface.php#L90)
###### Returns
[`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) — The relationship tuple pattern for filtering results
<!-- End of evansims/openfga-php/docs/API/Requests/ReadTuplesRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/RequestInterface.md -->
### RequestInterface
Base interface for all OpenFGA API request objects. This interface defines the core contract that all OpenFGA API requests must implement. Request objects encapsulate the parameters and configuration needed for specific API operations, providing a structured way to prepare HTTP requests for the OpenFGA service. Each request implementation handles: - Parameter validation and constraints - Request body serialization and formatting - HTTP method and endpoint determination - Header configuration and content negotiation - URL path construction with proper parameter encoding The interface follows the Command pattern, where each request object represents a specific operation to be performed against the OpenFGA API. This design enables consistent request handling, validation, and testing across all API operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getRequest()`](#getrequest)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php)
#### Related Classes
- [ResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) (response)
#### Methods
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
<!-- End of evansims/openfga-php/docs/API/Requests/RequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/StreamedListObjectsRequest.md -->
### StreamedListObjectsRequest
Request for streaming objects that a user has a specific relationship with. This request finds all objects of a given type where the specified user has the requested relationship, returning results as a stream for efficient processing of large datasets. It's useful for building resource lists, dashboards, or any interface that shows what a user can access when dealing with thousands of objects.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getRelation()`](#getrelation)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getType()`](#gettype)
- [`getUser()`](#getuser)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php)
#### Implements
- [`StreamedListObjectsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/StreamedListObjectsRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [StreamedListObjectsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/StreamedListObjectsResponse.md) (response)
- [StreamedListObjectsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/StreamedListObjectsRequestInterface.md) (interface)
#### Methods
##### getConsistency
```php
public function getConsistency(): ?OpenFGA\Models\Enums\Consistency
```
Get the consistency requirement for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L86)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency requirement, or null if not specified
##### getContext
```php
public function getContext(): ?object
```
Get the context object for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L95)
###### Returns
`object` | `null` — The context object, or null if not specified
##### getContextualTuples
```php
public function getContextualTuples(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the contextual tuples for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L104)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — The contextual tuples collection, or null if not specified
##### getModel
```php
public function getModel(): ?string
```
Get the authorization model ID for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L113)
###### Returns
`string` | `null` — The authorization model ID, or null if not specified
##### getRelation
```php
public function getRelation(): string
```
Get the relation name for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L122)
###### Returns
`string` — The relation name to check
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L133)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L160)
###### Returns
`string` — The store ID
##### getType
```php
public function getType(): string
```
Get the object type for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L169)
###### Returns
`string` — The object type to list
##### getUser
```php
public function getUser(): string
```
Get the user identifier for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequest.php#L178)
###### Returns
`string` — The user identifier
<!-- End of evansims/openfga-php/docs/API/Requests/StreamedListObjectsRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/StreamedListObjectsRequestInterface.md -->
### StreamedListObjectsRequestInterface
Request interface for streaming objects that a user has a specific relationship with. This request finds all objects of a given type where the specified user has the requested relationship, but returns them as a stream for processing large result sets efficiently. It's useful for building resource lists, dashboards, or any interface that shows what a user can access when dealing with large datasets.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getConsistency()`](#getconsistency)
- [`getContext()`](#getcontext)
- [`getContextualTuples()`](#getcontextualtuples)
- [`getModel()`](#getmodel)
- [`getRelation()`](#getrelation)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
- [`getType()`](#gettype)
- [`getUser()`](#getuser)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [StreamedListObjectsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/StreamedListObjectsResponseInterface.md) (response)
- [StreamedListObjectsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/StreamedListObjectsRequest.md) (implementation)
#### Methods
##### getConsistency
```php
public function getConsistency(): Consistency|null
```
Get the consistency requirement for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L27)
###### Returns
[`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` — The consistency requirement, or null if not specified
##### getContext
```php
public function getContext(): object|null
```
Get the context object for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L34)
###### Returns
`object` | `null` — The context object, or null if not specified
##### getContextualTuples
```php
public function getContextualTuples(): TupleKeysInterface|null
```
Get the contextual tuples for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L41)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — The contextual tuples collection, or null if not specified
##### getModel
```php
public function getModel(): string|null
```
Get the authorization model ID for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L48)
###### Returns
`string` | `null` — The authorization model ID, or null if not specified
##### getRelation
```php
public function getRelation(): string
```
Get the relation name for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L55)
###### Returns
`string` — The relation name to check
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L62)
###### Returns
`string` — The store ID
##### getType
```php
public function getType(): string
```
Get the object type for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L69)
###### Returns
`string` — The object type to list
##### getUser
```php
public function getUser(): string
```
Get the user identifier for this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/StreamedListObjectsRequestInterface.php#L76)
###### Returns
`string` — The user identifier
<!-- End of evansims/openfga-php/docs/API/Requests/StreamedListObjectsRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/WriteAssertionsRequest.md -->
### WriteAssertionsRequest
Request for writing test assertions to validate authorization model behavior. This request stores test assertions that define expected authorization outcomes for specific scenarios. Assertions are used to validate that authorization models behave correctly and can be run as part of testing and validation workflows.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAssertions()`](#getassertions)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequest.php)
#### Implements
- [`WriteAssertionsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/WriteAssertionsRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [WriteAssertionsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/WriteAssertionsResponse.md) (response)
- [WriteAssertionsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/WriteAssertionsRequestInterface.md) (interface)
#### Methods
##### getAssertions
```php
public function getAssertions(): OpenFGA\Models\Collections\AssertionsInterface
```
Get the test assertions to write to the authorization model. Returns a collection of assertions that define test scenarios for the authorization model. Each assertion specifies a permission check and its expected outcome, creating a comprehensive test suite that verifies the model's behavior across various scenarios. Assertions help ensure that: - Permission checks return expected results - Model changes don't introduce regressions - Complex authorization logic works correctly - Edge cases and special scenarios are properly handled - Documentation of expected behavior is maintained
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequest.php#L61)
###### Returns
[`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) — Collection of test assertions to validate authorization model behavior
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to associate assertions with. Specifies which version of the authorization model these assertions should be tied to. Assertions are version-specific, allowing you to maintain different test suites for different model versions and ensure that tests remain relevant as your authorization schema evolves.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequest.php#L70)
###### Returns
`string` — The authorization model ID that these assertions will test
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequest.php#L81)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID where assertions will be written. Identifies the OpenFGA store that contains the authorization model and where the test assertions will be stored. Assertions are stored alongside the model they test, providing a complete testing framework within each store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequest.php#L98)
###### Returns
`string` — The store ID where the test assertions will be written
<!-- End of evansims/openfga-php/docs/API/Requests/WriteAssertionsRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/WriteAssertionsRequestInterface.md -->
### WriteAssertionsRequestInterface
Interface for writing test assertions to an authorization model. This interface defines the contract for requests that create or update test assertions for authorization models in OpenFGA. Assertions are automated tests that verify your authorization model behaves as expected by checking specific permission scenarios against known outcomes. Assertions serve multiple important purposes: - **Testing**: Verify that your authorization model produces expected results - **Validation**: Ensure model changes don't break existing authorization logic - **Documentation**: Provide examples of how permissions should work - **Regression Prevention**: Catch unintended changes to authorization behavior - **Continuous Integration**: Enable automated testing of authorization logic Each assertion defines: - A specific permission check scenario (user, object, relation) - The expected outcome (allowed or denied) - Optional contextual data for conditional authorization Assertions are tied to specific authorization model versions, allowing you to maintain test suites that evolve with your authorization schema. When you create a new model version, you can run existing assertions to ensure backward compatibility or create new assertions for new functionality. This is essential for maintaining confidence in your authorization system as it evolves, especially in complex scenarios with inheritance, conditions, and computed relationships.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAssertions()`](#getassertions)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getStore()`](#getstore)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [WriteAssertionsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/WriteAssertionsResponseInterface.md) (response)
- [WriteAssertionsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/WriteAssertionsRequest.md) (implementation)
#### Methods
##### getAssertions
```php
public function getAssertions(): AssertionsInterface
```
Get the test assertions to write to the authorization model. Returns a collection of assertions that define test scenarios for the authorization model. Each assertion specifies a permission check and its expected outcome, creating a comprehensive test suite that verifies the model's behavior across various scenarios. Assertions help ensure that: - Permission checks return expected results - Model changes don't introduce regressions - Complex authorization logic works correctly - Edge cases and special scenarios are properly handled - Documentation of expected behavior is maintained
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequestInterface.php#L62)
###### Returns
[`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) — Collection of test assertions to validate authorization model behavior
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to associate assertions with. Specifies which version of the authorization model these assertions should be tied to. Assertions are version-specific, allowing you to maintain different test suites for different model versions and ensure that tests remain relevant as your authorization schema evolves.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequestInterface.php#L74)
###### Returns
`string` — The authorization model ID that these assertions will test
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getStore
```php
public function getStore(): string
```
Get the store ID where assertions will be written. Identifies the OpenFGA store that contains the authorization model and where the test assertions will be stored. Assertions are stored alongside the model they test, providing a complete testing framework within each store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteAssertionsRequestInterface.php#L86)
###### Returns
`string` — The store ID where the test assertions will be written
<!-- End of evansims/openfga-php/docs/API/Requests/WriteAssertionsRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/WriteTuplesRequest.md -->
### WriteTuplesRequest
Request for writing and deleting relationship tuples in OpenFGA. This request enables batch creation and deletion of relationship tuples, supporting both transactional (all-or-nothing) and non-transactional (independent operations) modes. Transactional mode ensures atomic changes, while non-transactional mode allows for parallel processing with detailed success/failure tracking.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`chunk()`](#chunk)
- [`getDeletes()`](#getdeletes)
- [`getMaxParallelRequests()`](#getmaxparallelrequests)
- [`getMaxRetries()`](#getmaxretries)
- [`getMaxTuplesPerChunk()`](#getmaxtuplesperchunk)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getRetryDelaySeconds()`](#getretrydelayseconds)
- [`getStopOnFirstError()`](#getstoponfirsterror)
- [`getStore()`](#getstore)
- [`getTotalOperations()`](#gettotaloperations)
- [`getWrites()`](#getwrites)
- [`isEmpty()`](#isempty)
- [`isTransactional()`](#istransactional)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php)
#### Implements
- [`WriteTuplesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/WriteTuplesRequestInterface.md)
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [WriteTuplesResponse](https://github.com/evansims/openfga-php/blob/main/Responses/WriteTuplesResponse.md) (response)
- [WriteTuplesRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/WriteTuplesRequestInterface.md) (interface)
#### Methods
##### chunk
```php
public function chunk(int $chunkSize): array<WriteTuplesRequest>
```
Split this request into smaller chunks for non-transactional processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L95)
###### Parameters
| Name | Type | Description |
| ------------ | ----- | -------------------------------- |
| `$chunkSize` | `int` | Maximum tuples per chunk (1-100) |
###### Returns
`array<[`WriteTuplesRequest`](https://github.com/evansims/openfga-php/blob/main/WriteTuplesRequest.md)>` — Array of chunked requests
##### getDeletes
```php
public function getDeletes(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the relationship tuples to delete from the store. Returns a collection of relationship tuples that should be removed from the authorization store. Each tuple represents a permission or relationship that will be revoked. The deletion is atomic with any write operations specified in the same request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L165)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of relationship tuples to remove, or null if no deletions are requested
##### getMaxParallelRequests
```php
public function getMaxParallelRequests(): int
```
Get the maximum number of parallel requests for non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L174)
###### Returns
`int` — Maximum parallel requests (1 for sequential processing)
##### getMaxRetries
```php
public function getMaxRetries(): int
```
Get the maximum number of retries for failed chunks in non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L183)
###### Returns
`int` — Maximum retry attempts
##### getMaxTuplesPerChunk
```php
public function getMaxTuplesPerChunk(): int
```
Get the maximum number of tuples per chunk for non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L192)
###### Returns
`int` — Maximum tuples per chunk (up to 100)
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to use for tuple validation. Specifies which version of the authorization model should be used to validate the relationship tuples being written or deleted. This ensures that all tuples conform to the expected schema and relationship types defined in the model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L201)
###### Returns
`string` — The authorization model ID for validating tuple operations
##### getRequest
```php
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L212)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
[`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getRetryDelaySeconds
```php
public function getRetryDelaySeconds(): float
```
Get the retry delay in seconds for non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L233)
###### Returns
`float` — Retry delay in seconds
##### getStopOnFirstError
```php
public function getStopOnFirstError(): bool
```
Check if non-transactional processing should stop on first error.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L242)
###### Returns
`bool` — True to stop on first error, false to continue
##### getStore
```php
public function getStore(): string
```
Get the store ID where tuples will be written. Identifies the OpenFGA store that contains the authorization data to be modified. All write and delete operations will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L251)
###### Returns
`string` — The store ID containing the authorization data to modify
##### getTotalOperations
```php
public function getTotalOperations(): int
```
Get the total number of tuple operations in this request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L261)
###### Returns
`int` — Total count of write and delete operations
##### getWrites
```php
public function getWrites(): ?OpenFGA\Models\Collections\TupleKeysInterface
```
Get the relationship tuples to write to the store. Returns a collection of relationship tuples that should be added to the authorization store. Each tuple represents a new permission or relationship that will be granted. The write operation is atomic with any delete operations specified in the same request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L273)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of relationship tuples to add, or null if no writes are requested
##### isEmpty
```php
public function isEmpty(): bool
```
Check if this request contains any operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L283)
###### Returns
`bool` — True if the request has no operations
##### isTransactional
```php
public function isTransactional(): bool
```
Check if this request should be executed in transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequest.php#L292)
###### Returns
`bool` — True for transactional mode, false for non-transactional
<!-- End of evansims/openfga-php/docs/API/Requests/WriteTuplesRequest.md -->
<!-- Source: evansims/openfga-php/docs/API/Requests/WriteTuplesRequestInterface.md -->
### WriteTuplesRequestInterface
Interface for writing relationship tuples to an OpenFGA store. This interface defines the contract for requests that modify relationship data in OpenFGA stores. It supports both adding new relationships (writes) and removing existing relationships (deletes) in a single atomic operation. Write operations are transactional, meaning either all changes succeed or all changes are rolled back. This ensures data consistency when making multiple related changes to the authorization graph. The request allows you to: - Add new relationship tuples to establish permissions - Remove existing relationship tuples to revoke permissions - Perform both operations atomically in a single request - Specify which authorization model version to use for validation
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getDeletes()`](#getdeletes)
- [`getMaxParallelRequests()`](#getmaxparallelrequests)
- [`getMaxRetries()`](#getmaxretries)
- [`getMaxTuplesPerChunk()`](#getmaxtuplesperchunk)
- [`getModel()`](#getmodel)
- [`getRequest()`](#getrequest)
- [`getRetryDelaySeconds()`](#getretrydelayseconds)
- [`getStopOnFirstError()`](#getstoponfirsterror)
- [`getStore()`](#getstore)
- [`getWrites()`](#getwrites)
- [`isTransactional()`](#istransactional)
</details>
#### Namespace
`OpenFGA\Requests`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php)
#### Implements
- [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/RequestInterface.md)
#### Related Classes
- [WriteTuplesResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/WriteTuplesResponseInterface.md) (response)
- [WriteTuplesRequest](https://github.com/evansims/openfga-php/blob/main/Requests/WriteTuplesRequest.md) (implementation)
#### Methods
##### getDeletes
```php
public function getDeletes(): TupleKeysInterface|null
```
Get the relationship tuples to delete from the store. Returns a collection of relationship tuples that should be removed from the authorization store. Each tuple represents a permission or relationship that will be revoked. The deletion is atomic with any write operations specified in the same request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L43)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of relationship tuples to remove, or null if no deletions are requested
##### getMaxParallelRequests
```php
public function getMaxParallelRequests(): int
```
Get the maximum number of parallel requests for non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L50)
###### Returns
`int` — Maximum parallel requests (1 for sequential processing)
##### getMaxRetries
```php
public function getMaxRetries(): int
```
Get the maximum number of retries for failed chunks in non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L57)
###### Returns
`int` — Maximum retry attempts
##### getMaxTuplesPerChunk
```php
public function getMaxTuplesPerChunk(): int
```
Get the maximum number of tuples per chunk for non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L64)
###### Returns
`int` — Maximum tuples per chunk (up to 100)
##### getModel
```php
public function getModel(): string
```
Get the authorization model ID to use for tuple validation. Specifies which version of the authorization model should be used to validate the relationship tuples being written or deleted. This ensures that all tuples conform to the expected schema and relationship types defined in the model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L76)
###### Returns
`string` — The authorization model ID for validating tuple operations
##### getRequest
```php
public function getRequest(StreamFactoryInterface $streamFactory): RequestContext
```
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/RequestInterface.php#L57)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | PSR-7 stream factory for creating request body streams from serialized data |
###### Returns
`RequestContext` — The prepared request context containing HTTP method, URL, headers, and body ready for execution
##### getRetryDelaySeconds
```php
public function getRetryDelaySeconds(): float
```
Get the retry delay in seconds for non-transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L83)
###### Returns
`float` — Retry delay in seconds
##### getStopOnFirstError
```php
public function getStopOnFirstError(): bool
```
Check if non-transactional processing should stop on first error.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L90)
###### Returns
`bool` — True to stop on first error, false to continue
##### getStore
```php
public function getStore(): string
```
Get the store ID where tuples will be written. Identifies the OpenFGA store that contains the authorization data to be modified. All write and delete operations will be performed within the context of this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L101)
###### Returns
`string` — The store ID containing the authorization data to modify
##### getWrites
```php
public function getWrites(): TupleKeysInterface|null
```
Get the relationship tuples to write to the store. Returns a collection of relationship tuples that should be added to the authorization store. Each tuple represents a new permission or relationship that will be granted. The write operation is atomic with any delete operations specified in the same request.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L113)
###### Returns
[`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` — Collection of relationship tuples to add, or null if no writes are requested
##### isTransactional
```php
public function isTransactional(): bool
```
Check if this request should be executed in transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Requests/WriteTuplesRequestInterface.php#L120)
###### Returns
`bool` — True for transactional mode, false for non-transactional
<!-- End of evansims/openfga-php/docs/API/Requests/WriteTuplesRequestInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/BatchCheckResponse.md -->
### BatchCheckResponse
Response containing the results of a batch authorization check. This response contains a map of correlation IDs to check results, allowing you to match each result back to the original check request using the correlation ID that was provided in the batch request.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getResult()`](#getresult)
- [`getResultForCorrelationId()`](#getresultforcorrelationid)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/BatchCheckResponse.php)
#### Implements
- [`BatchCheckResponseInterface`](https://github.com/evansims/openfga-php/blob/main/BatchCheckResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [BatchCheckResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/BatchCheckResponseInterface.md) (interface)
- [BatchCheckRequest](https://github.com/evansims/openfga-php/blob/main/Requests/BatchCheckRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\BatchCheckResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getResult
```php
public function getResult(): array
```
Get the results map from correlation IDs to check results. Each key in the map is a correlation ID from the original request, and each value is the result of that specific check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/BatchCheckResponse.php#L102)
###### Returns
`array` — Map of correlation ID to check result
##### getResultForCorrelationId
```php
public function getResultForCorrelationId(string $correlationId): ?OpenFGA\Models\BatchCheckSingleResultInterface
```
Get the result for a specific correlation ID. Returns the check result for the given correlation ID, or null if no result exists for that ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/BatchCheckResponse.php#L111)
###### Parameters
| Name | Type | Description |
| ---------------- | -------- | ----------------------------- |
| `$correlationId` | `string` | The correlation ID to look up |
###### Returns
[`BatchCheckSingleResultInterface`](https://github.com/evansims/openfga-php/blob/main/Models/BatchCheckSingleResultInterface.md) | `null`
<!-- End of evansims/openfga-php/docs/API/Responses/BatchCheckResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/BatchCheckResponseInterface.md -->
### BatchCheckResponseInterface
Response containing the results of a batch authorization check. This response contains a map of correlation IDs to check results, allowing you to match each result back to the original check request using the correlation ID that was provided in the batch request.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getResult()`](#getresult)
- [`getResultForCorrelationId()`](#getresultforcorrelationid)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/BatchCheckResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [BatchCheckResponse](https://github.com/evansims/openfga-php/blob/main/Responses/BatchCheckResponse.md) (implementation)
- [BatchCheckRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/BatchCheckRequestInterface.md) (request)
#### Methods
##### getResult
```php
public function getResult(): array<string, BatchCheckSingleResultInterface>
```
Get the results map from correlation IDs to check results. Each key in the map is a correlation ID from the original request, and each value is the result of that specific check.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/BatchCheckResponseInterface.php#L29)
###### Returns
`array<`string`, [`BatchCheckSingleResultInterface`](https://github.com/evansims/openfga-php/blob/main/Models/BatchCheckSingleResultInterface.md)>` — Map of correlation ID to check result
##### getResultForCorrelationId
```php
public function getResultForCorrelationId(string $correlationId): ?OpenFGA\Models\BatchCheckSingleResultInterface
```
Get the result for a specific correlation ID. Returns the check result for the given correlation ID, or null if no result exists for that ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/BatchCheckResponseInterface.php#L40)
###### Parameters
| Name | Type | Description |
| ---------------- | -------- | ----------------------------- |
| `$correlationId` | `string` | The correlation ID to look up |
###### Returns
[`BatchCheckSingleResultInterface`](https://github.com/evansims/openfga-php/blob/main/Models/BatchCheckSingleResultInterface.md) | `null`
<!-- End of evansims/openfga-php/docs/API/Responses/BatchCheckResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/CheckResponse.md -->
### CheckResponse
Response containing the result of an authorization check. This response indicates whether a user has a specific relationship with an object, along with optional resolution details explaining how the decision was reached. Use this to make authorization decisions in your application.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getAllowed()`](#getallowed)
- [`getResolution()`](#getresolution)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/CheckResponse.php)
#### Implements
- [`CheckResponseInterface`](https://github.com/evansims/openfga-php/blob/main/CheckResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [CheckResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/CheckResponseInterface.md) (interface)
- [CheckRequest](https://github.com/evansims/openfga-php/blob/main/Requests/CheckRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\CheckResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getAllowed
```php
public function getAllowed(): ?bool
```
Get whether the permission check was allowed. This is the primary result of the permission check operation, indicating whether the specified user has the requested permission on the given object according to the authorization model and current relationship data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CheckResponse.php#L88)
###### Returns
`bool` | `null` — True if permission is granted, false if denied, or null if the result is indeterminate
##### getResolution
```php
public function getResolution(): ?string
```
Get the resolution details for the permission decision. This provides additional information about how the permission decision was reached, which can be useful for understanding complex authorization logic or debugging permission issues.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CheckResponse.php#L97)
###### Returns
`string` | `null` — The resolution details explaining the permission decision, or null if not provided
##### schema
*<small>Implements Responses\CheckResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. This method returns the schema that defines the structure and validation rules for check response data, ensuring consistent parsing and validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CheckResponseInterface.php#L32)
###### Returns
`SchemaInterface` — The schema definition for check response validation
<!-- End of evansims/openfga-php/docs/API/Responses/CheckResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/CheckResponseInterface.md -->
### CheckResponseInterface
Interface for permission check response objects. This interface defines the contract for responses returned when performing permission checks in OpenFGA. A check response indicates whether a specific user has a particular permission on a given object, based on the authorization model and current relationship data. Permission checking is the core operation of OpenFGA, allowing applications to make authorization decisions by evaluating user permissions against the defined relationship model and stored tuples.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAllowed()`](#getallowed)
- [`getResolution()`](#getresolution)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/CheckResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [CheckResponse](https://github.com/evansims/openfga-php/blob/main/Responses/CheckResponse.md) (implementation)
- [CheckRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/CheckRequestInterface.md) (request)
#### Methods
##### getAllowed
```php
public function getAllowed(): bool|null
```
Get whether the permission check was allowed. This is the primary result of the permission check operation, indicating whether the specified user has the requested permission on the given object according to the authorization model and current relationship data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CheckResponseInterface.php#L43)
###### Returns
`bool` | `null` — True if permission is granted, false if denied, or null if the result is indeterminate
##### getResolution
```php
public function getResolution(): string|null
```
Get the resolution details for the permission decision. This provides additional information about how the permission decision was reached, which can be useful for understanding complex authorization logic or debugging permission issues.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CheckResponseInterface.php#L54)
###### Returns
`string` | `null` — The resolution details explaining the permission decision, or null if not provided
<!-- End of evansims/openfga-php/docs/API/Responses/CheckResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/CreateAuthorizationModelResponse.md -->
### CreateAuthorizationModelResponse
Response confirming successful creation of a new authorization model. This response provides the unique identifier of the newly created authorization model, which can be used for subsequent operations like checks, expansions, and model management activities.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getModel()`](#getmodel)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateAuthorizationModelResponse.php)
#### Implements
- [`CreateAuthorizationModelResponseInterface`](https://github.com/evansims/openfga-php/blob/main/CreateAuthorizationModelResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [CreateAuthorizationModelResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/CreateAuthorizationModelResponseInterface.md) (interface)
- [CreateAuthorizationModelRequest](https://github.com/evansims/openfga-php/blob/main/Requests/CreateAuthorizationModelRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\CreateAuthorizationModelResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getModel
```php
public function getModel(): string
```
Get the unique identifier of the created authorization model. Returns the system-generated unique identifier for the newly created authorization model. This ID is used in subsequent API operations to reference this specific model version for authorization checks and other operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateAuthorizationModelResponse.php#L85)
###### Returns
`string` — The unique authorization model identifier
##### schema
*<small>Implements Responses\CreateAuthorizationModelResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for authorization model creation response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateAuthorizationModelResponseInterface.php#L32)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/CreateAuthorizationModelResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/CreateAuthorizationModelResponseInterface.md -->
### CreateAuthorizationModelResponseInterface
Interface for authorization model creation response objects. This interface defines the contract for responses returned when creating new authorization models in OpenFGA. An authorization model creation response contains the unique identifier of the newly created model, which can be used for subsequent operations. Authorization models define the relationship types, object types, and permission logic that govern how authorization decisions are made within a store. They are versioned, allowing you to evolve your permission structure over time.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModel()`](#getmodel)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateAuthorizationModelResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [CreateAuthorizationModelResponse](https://github.com/evansims/openfga-php/blob/main/Responses/CreateAuthorizationModelResponse.md) (implementation)
- [CreateAuthorizationModelRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/CreateAuthorizationModelRequestInterface.md) (request)
#### Methods
##### getModel
```php
public function getModel(): string
```
Get the unique identifier of the created authorization model. Returns the system-generated unique identifier for the newly created authorization model. This ID is used in subsequent API operations to reference this specific model version for authorization checks and other operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateAuthorizationModelResponseInterface.php#L43)
###### Returns
`string` — The unique authorization model identifier
<!-- End of evansims/openfga-php/docs/API/Responses/CreateAuthorizationModelResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/CreateStoreResponse.md -->
### CreateStoreResponse
Response confirming successful creation of a new store. This response provides the details of the newly created authorization store, including its unique identifier, name, and creation timestamps. Use the store ID for subsequent operations like managing authorization models and tuples.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getCreatedAt()`](#getcreatedat)
- [`getId()`](#getid)
- [`getName()`](#getname)
- [`getUpdatedAt()`](#getupdatedat)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponse.php)
#### Implements
- [`CreateStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/CreateStoreResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [CreateStoreResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/CreateStoreResponseInterface.md) (interface)
- [CreateStoreRequest](https://github.com/evansims/openfga-php/blob/main/Requests/CreateStoreRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\CreateStoreResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getCreatedAt
```php
public function getCreatedAt(): DateTimeImmutable
```
Get the timestamp when the store was created. Returns the exact moment when the store was successfully created in the OpenFGA system. This timestamp is immutable and set by the server upon store creation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponse.php#L97)
###### Returns
`DateTimeImmutable` — The creation timestamp of the store
##### getId
```php
public function getId(): string
```
Get the unique identifier of the created store. Returns the system-generated unique identifier for the newly created store. This ID is used in all subsequent API operations to reference this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponse.php#L106)
###### Returns
`string` — The unique store identifier
##### getName
```php
public function getName(): string
```
Get the human-readable name of the created store. Returns the descriptive name that was assigned to the store during creation. This name is used for identification and administrative purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponse.php#L115)
###### Returns
`string` — The descriptive name of the store
##### getUpdatedAt
```php
public function getUpdatedAt(): DateTimeImmutable
```
Get the timestamp when the store was last updated. Returns the timestamp of the most recent modification to the store's metadata. For newly created stores, this will typically match the creation timestamp.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponse.php#L124)
###### Returns
`DateTimeImmutable` — The last update timestamp of the store
##### schema
*<small>Implements Responses\CreateStoreResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for store creation response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponseInterface.php#L32)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/CreateStoreResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/CreateStoreResponseInterface.md -->
### CreateStoreResponseInterface
Interface for store creation response objects. This interface defines the contract for responses returned when creating new authorization stores in OpenFGA. A store creation response contains the newly created store's metadata including its unique identifier, name, and timestamps. Store creation is the foundational operation for establishing an authorization domain where you can define relationship models, write authorization tuples, and perform permission checks.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getCreatedAt()`](#getcreatedat)
- [`getId()`](#getid)
- [`getName()`](#getname)
- [`getUpdatedAt()`](#getupdatedat)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [CreateStoreResponse](https://github.com/evansims/openfga-php/blob/main/Responses/CreateStoreResponse.md) (implementation)
- [CreateStoreRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/CreateStoreRequestInterface.md) (request)
#### Methods
##### getCreatedAt
```php
public function getCreatedAt(): DateTimeImmutable
```
Get the timestamp when the store was created. Returns the exact moment when the store was successfully created in the OpenFGA system. This timestamp is immutable and set by the server upon store creation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponseInterface.php#L42)
###### Returns
`DateTimeImmutable` — The creation timestamp of the store
##### getId
```php
public function getId(): string
```
Get the unique identifier of the created store. Returns the system-generated unique identifier for the newly created store. This ID is used in all subsequent API operations to reference this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponseInterface.php#L52)
###### Returns
`string` — The unique store identifier
##### getName
```php
public function getName(): string
```
Get the human-readable name of the created store. Returns the descriptive name that was assigned to the store during creation. This name is used for identification and administrative purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponseInterface.php#L62)
###### Returns
`string` — The descriptive name of the store
##### getUpdatedAt
```php
public function getUpdatedAt(): DateTimeImmutable
```
Get the timestamp when the store was last updated. Returns the timestamp of the most recent modification to the store's metadata. For newly created stores, this will typically match the creation timestamp.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/CreateStoreResponseInterface.php#L72)
###### Returns
`DateTimeImmutable` — The last update timestamp of the store
<!-- End of evansims/openfga-php/docs/API/Responses/CreateStoreResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/DeleteStoreResponse.md -->
### DeleteStoreResponse
Response confirming successful deletion of a store. This response is returned when a store has been successfully deleted from the OpenFGA service. The response contains no additional data as the store has been permanently removed.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/DeleteStoreResponse.php)
#### Implements
- [`DeleteStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/DeleteStoreResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [DeleteStoreResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/DeleteStoreResponseInterface.md) (interface)
- [DeleteStoreRequest](https://github.com/evansims/openfga-php/blob/main/Requests/DeleteStoreRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\DeleteStoreResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
<!-- End of evansims/openfga-php/docs/API/Responses/DeleteStoreResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/DeleteStoreResponseInterface.md -->
### DeleteStoreResponseInterface
Interface for store deletion response objects. This interface defines the contract for responses returned when deleting stores from OpenFGA. Store deletion responses typically contain no additional data beyond the successful HTTP status, indicating that the store has been marked for deletion. Store deletion is a destructive operation that removes all authorization data associated with the store, including relationship tuples and authorization models.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/DeleteStoreResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [DeleteStoreResponse](https://github.com/evansims/openfga-php/blob/main/Responses/DeleteStoreResponse.md) (implementation)
- [DeleteStoreRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/DeleteStoreRequestInterface.md) (request)
<!-- End of evansims/openfga-php/docs/API/Responses/DeleteStoreResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ExpandResponse.md -->
### ExpandResponse
Response containing the expanded userset tree for a relationship query. This response provides a hierarchical tree structure showing how a relationship is computed, including all the users, usersets, and computed relationships that contribute to the final authorization decision.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getTree()`](#gettree)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ExpandResponse.php)
#### Implements
- [`ExpandResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ExpandResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ExpandResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ExpandResponseInterface.md) (interface)
- [ExpandRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ExpandRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ExpandResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getTree
```php
public function getTree(): ?OpenFGA\Models\UsersetTreeInterface
```
Get the expansion tree for the queried relationship. Returns a hierarchical tree structure that represents all users and usersets that have the specified relationship with the target object. The tree shows both direct relationships and computed relationships through other relations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ExpandResponse.php#L107)
###### Returns
[`UsersetTreeInterface`](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTreeInterface.md) | `null` — The relationship expansion tree, or null if no relationships found
##### schema
*<small>Implements Responses\ExpandResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for relationship expansion response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ExpandResponseInterface.php#L34)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ExpandResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ExpandResponseInterface.md -->
### ExpandResponseInterface
Interface for relationship expansion response objects. This interface defines the contract for responses returned when expanding relationships in OpenFGA. An expand response contains a tree structure that shows all the users and usersets that have a particular relationship with an object, providing a comprehensive view of the authorization graph. Relationship expansion is useful for understanding complex authorization structures, debugging permission issues, and visualizing how relationships are resolved.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getTree()`](#gettree)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ExpandResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ExpandResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ExpandResponse.md) (implementation)
- [ExpandRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ExpandRequestInterface.md) (request)
#### Methods
##### getTree
```php
public function getTree(): UsersetTreeInterface|null
```
Get the expansion tree for the queried relationship. Returns a hierarchical tree structure that represents all users and usersets that have the specified relationship with the target object. The tree shows both direct relationships and computed relationships through other relations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ExpandResponseInterface.php#L45)
###### Returns
[`UsersetTreeInterface`](https://github.com/evansims/openfga-php/blob/main/Models/UsersetTreeInterface.md) | `null` — The relationship expansion tree, or null if no relationships found
<!-- End of evansims/openfga-php/docs/API/Responses/ExpandResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/GetAuthorizationModelResponse.md -->
### GetAuthorizationModelResponse
Response containing a specific authorization model from the store. This response provides the complete authorization model including type definitions, relationships, and conditions. Use this to retrieve and examine the authorization schema that defines how permissions work in your application.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getModel()`](#getmodel)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetAuthorizationModelResponse.php)
#### Implements
- [`GetAuthorizationModelResponseInterface`](https://github.com/evansims/openfga-php/blob/main/GetAuthorizationModelResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [GetAuthorizationModelResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/GetAuthorizationModelResponseInterface.md) (interface)
- [GetAuthorizationModelRequest](https://github.com/evansims/openfga-php/blob/main/Requests/GetAuthorizationModelRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\GetAuthorizationModelResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getModel
```php
public function getModel(): ?OpenFGA\Models\AuthorizationModelInterface
```
Get the retrieved authorization model. Returns the complete authorization model including its type definitions, schema version, and any conditions. The model defines the relationship types and permission logic that govern authorization decisions within the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetAuthorizationModelResponse.php#L101)
###### Returns
[`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` — The authorization model, or null if not found
##### schema
*<small>Implements Responses\GetAuthorizationModelResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for authorization model response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetAuthorizationModelResponseInterface.php#L33)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/GetAuthorizationModelResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/GetAuthorizationModelResponseInterface.md -->
### GetAuthorizationModelResponseInterface
Interface for authorization model retrieval response objects. This interface defines the contract for responses returned when retrieving authorization models from OpenFGA. An authorization model defines the relationship types, object types, and permission logic that govern how authorization decisions are made within a store. Authorization models are versioned, allowing you to evolve your permission structure over time while maintaining consistency for existing authorization checks.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getModel()`](#getmodel)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetAuthorizationModelResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [GetAuthorizationModelResponse](https://github.com/evansims/openfga-php/blob/main/Responses/GetAuthorizationModelResponse.md) (implementation)
- [GetAuthorizationModelRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/GetAuthorizationModelRequestInterface.md) (request)
#### Methods
##### getModel
```php
public function getModel(): AuthorizationModelInterface|null
```
Get the retrieved authorization model. Returns the complete authorization model including its type definitions, schema version, and any conditions. The model defines the relationship types and permission logic that govern authorization decisions within the store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetAuthorizationModelResponseInterface.php#L44)
###### Returns
[`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` — The authorization model, or null if not found
<!-- End of evansims/openfga-php/docs/API/Responses/GetAuthorizationModelResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/GetStoreResponse.md -->
### GetStoreResponse
Response containing detailed information about a specific store. This response provides comprehensive store metadata including its unique identifier, name, and timestamps for creation, updates, and deletion (if applicable). Use this to retrieve information about an authorization store.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getCreatedAt()`](#getcreatedat)
- [`getDeletedAt()`](#getdeletedat)
- [`getId()`](#getid)
- [`getName()`](#getname)
- [`getStore()`](#getstore)
- [`getUpdatedAt()`](#getupdatedat)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponse.php)
#### Implements
- [`GetStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/GetStoreResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [GetStoreResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/GetStoreResponseInterface.md) (interface)
- [GetStoreRequest](https://github.com/evansims/openfga-php/blob/main/Requests/GetStoreRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\GetStoreResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getCreatedAt
```php
public function getCreatedAt(): DateTimeImmutable
```
Get the timestamp when the store was created. Returns the exact moment when the store was successfully created in the OpenFGA system. This timestamp is immutable and set by the server upon store creation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponse.php#L101)
###### Returns
`DateTimeImmutable` — The creation timestamp of the store
##### getDeletedAt
```php
public function getDeletedAt(): ?DateTimeImmutable
```
Get the timestamp when the store was deleted, if applicable. Returns the deletion timestamp for soft-deleted stores, or null if the store is active. This is used for stores that have been marked for deletion but may still be accessible for a grace period.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponse.php#L110)
###### Returns
`DateTimeImmutable` | `null` — The deletion timestamp, or null if the store is not deleted
##### getId
```php
public function getId(): string
```
Get the unique identifier of the store. Returns the system-generated unique identifier for the store. This ID is used in all API operations to reference this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponse.php#L119)
###### Returns
`string` — The unique store identifier
##### getName
```php
public function getName(): string
```
Get the human-readable name of the store. Returns the descriptive name that was assigned to the store during creation or last update. This name is used for identification and administrative purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponse.php#L128)
###### Returns
`string` — The descriptive name of the store
##### getStore
```php
public function getStore(): OpenFGA\Models\StoreInterface
```
Get the complete store object. Returns the full store object containing all store metadata and configuration. This provides access to the complete store data structure including any additional properties beyond the individual accessor methods.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponse.php#L137)
###### Returns
[`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) — The complete store object
##### getUpdatedAt
```php
public function getUpdatedAt(): DateTimeImmutable
```
Get the timestamp when the store was last updated. Returns the timestamp of the most recent modification to the store's metadata or configuration. This is updated whenever store properties are changed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponse.php#L152)
###### Returns
`DateTimeImmutable` — The last update timestamp of the store
##### schema
*<small>Implements Responses\GetStoreResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for store retrieval response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php#L34)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/GetStoreResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/GetStoreResponseInterface.md -->
### GetStoreResponseInterface
Interface for store retrieval response objects. This interface defines the contract for responses returned when retrieving store information from OpenFGA. A store retrieval response contains comprehensive metadata about the store including its identifier, name, timestamps, and full store object. Store retrieval is useful for administrative operations, auditing, and displaying store information in management interfaces.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getCreatedAt()`](#getcreatedat)
- [`getDeletedAt()`](#getdeletedat)
- [`getId()`](#getid)
- [`getName()`](#getname)
- [`getStore()`](#getstore)
- [`getUpdatedAt()`](#getupdatedat)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [GetStoreResponse](https://github.com/evansims/openfga-php/blob/main/Responses/GetStoreResponse.md) (implementation)
- [GetStoreRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/GetStoreRequestInterface.md) (request)
#### Methods
##### getCreatedAt
```php
public function getCreatedAt(): DateTimeImmutable
```
Get the timestamp when the store was created. Returns the exact moment when the store was successfully created in the OpenFGA system. This timestamp is immutable and set by the server upon store creation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php#L44)
###### Returns
`DateTimeImmutable` — The creation timestamp of the store
##### getDeletedAt
```php
public function getDeletedAt(): DateTimeImmutable|null
```
Get the timestamp when the store was deleted, if applicable. Returns the deletion timestamp for soft-deleted stores, or null if the store is active. This is used for stores that have been marked for deletion but may still be accessible for a grace period.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php#L55)
###### Returns
`DateTimeImmutable` | `null` — The deletion timestamp, or null if the store is not deleted
##### getId
```php
public function getId(): string
```
Get the unique identifier of the store. Returns the system-generated unique identifier for the store. This ID is used in all API operations to reference this specific store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php#L65)
###### Returns
`string` — The unique store identifier
##### getName
```php
public function getName(): string
```
Get the human-readable name of the store. Returns the descriptive name that was assigned to the store during creation or last update. This name is used for identification and administrative purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php#L75)
###### Returns
`string` — The descriptive name of the store
##### getStore
```php
public function getStore(): StoreInterface
```
Get the complete store object. Returns the full store object containing all store metadata and configuration. This provides access to the complete store data structure including any additional properties beyond the individual accessor methods.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php#L86)
###### Returns
[`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) — The complete store object
##### getUpdatedAt
```php
public function getUpdatedAt(): DateTimeImmutable
```
Get the timestamp when the store was last updated. Returns the timestamp of the most recent modification to the store's metadata or configuration. This is updated whenever store properties are changed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/GetStoreResponseInterface.php#L96)
###### Returns
`DateTimeImmutable` — The last update timestamp of the store
<!-- End of evansims/openfga-php/docs/API/Responses/GetStoreResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListAuthorizationModelsResponse.md -->
### ListAuthorizationModelsResponse
Response containing a paginated list of authorization models. This response provides access to authorization models within a store, including pagination support for handling large numbers of models. Each model includes its ID, schema version, and complete type definitions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getModels()`](#getmodels)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListAuthorizationModelsResponse.php)
#### Implements
- [`ListAuthorizationModelsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ListAuthorizationModelsResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListAuthorizationModelsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListAuthorizationModelsResponseInterface.md) (interface)
- [ListAuthorizationModelsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListAuthorizationModelsRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ListAuthorizationModelsResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of authorization models exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListAuthorizationModelsResponse.php#L103)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
##### getModels
```php
public function getModels(): OpenFGA\Models\Collections\AuthorizationModelsInterface
```
Get the collection of authorization models. Returns a type-safe collection containing the authorization model objects from the current page of results. Each model includes its ID, type definitions, schema version, and any conditions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListAuthorizationModelsResponse.php#L112)
###### Returns
[`AuthorizationModelsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AuthorizationModelsInterface.md) — The collection of authorization models
##### schema
*<small>Implements Responses\ListAuthorizationModelsResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for authorization models listing response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListAuthorizationModelsResponseInterface.php#L33)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ListAuthorizationModelsResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListAuthorizationModelsResponseInterface.md -->
### ListAuthorizationModelsResponseInterface
Interface for authorization models listing response objects. This interface defines the contract for responses returned when listing authorization models from an OpenFGA store. The response includes a collection of authorization models and pagination support for handling large numbers of models efficiently. Authorization model listing is useful for administrative operations, model versioning management, and allowing users to select from available model versions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getModels()`](#getmodels)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListAuthorizationModelsResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListAuthorizationModelsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListAuthorizationModelsResponse.md) (implementation)
- [ListAuthorizationModelsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListAuthorizationModelsRequestInterface.md) (request)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of authorization models exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListAuthorizationModelsResponseInterface.php#L44)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
##### getModels
```php
public function getModels(): AuthorizationModelsInterface
```
Get the collection of authorization models. Returns a type-safe collection containing the authorization model objects from the current page of results. Each model includes its ID, type definitions, schema version, and any conditions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListAuthorizationModelsResponseInterface.php#L55)
###### Returns
[`AuthorizationModelsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AuthorizationModelsInterface.md) — The collection of authorization models
<!-- End of evansims/openfga-php/docs/API/Responses/ListAuthorizationModelsResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListObjectsResponse.md -->
### ListObjectsResponse
Response containing a list of objects that a user has a specific relationship with. This response provides an array of object identifiers that the specified user has the given relationship with. Use this to discover what resources a user can access in your authorization system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getObjects()`](#getobjects)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListObjectsResponse.php)
#### Implements
- [`ListObjectsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ListObjectsResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListObjectsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListObjectsResponseInterface.md) (interface)
- [ListObjectsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListObjectsRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ListObjectsResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getObjects
```php
public function getObjects(): array
```
Get the array of object identifiers the user has access to. Returns an array of object identifiers that the queried user has the specified relationship with. Each string represents an object ID of the requested type that the user can access through the specified relation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListObjectsResponse.php#L87)
###### Returns
`array` — Array of object identifiers the user has access to
##### schema
*<small>Implements Responses\ListObjectsResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for object listing response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListObjectsResponseInterface.php#L33)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ListObjectsResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListObjectsResponseInterface.md -->
### ListObjectsResponseInterface
Interface for object listing response objects. This interface defines the contract for responses returned when listing objects that a user has access to in OpenFGA. This is the inverse of permission checking - instead of asking "can this user access this object?," it asks "what objects can this user access?" Object listing is particularly useful for building user interfaces that need to display only the resources a user can access, such as file listings, document repositories, or administrative dashboards.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getObjects()`](#getobjects)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListObjectsResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListObjectsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListObjectsResponse.md) (implementation)
- [ListObjectsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListObjectsRequestInterface.md) (request)
#### Methods
##### getObjects
```php
public function getObjects(): array<int, string>
```
Get the array of object identifiers the user has access to. Returns an array of object identifiers that the queried user has the specified relationship with. Each string represents an object ID of the requested type that the user can access through the specified relation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListObjectsResponseInterface.php#L44)
###### Returns
`array<`int`, `string`>` — Array of object identifiers the user has access to
<!-- End of evansims/openfga-php/docs/API/Responses/ListObjectsResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListStoresResponse.md -->
### ListStoresResponse
Response containing a paginated list of available stores. This response provides access to stores that the authenticated user or application can access, with pagination support for handling large numbers of stores. Each store includes its ID, name, and creation metadata.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getStores()`](#getstores)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListStoresResponse.php)
#### Implements
- [`ListStoresResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ListStoresResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListStoresResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListStoresResponseInterface.md) (interface)
- [ListStoresRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListStoresRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ListStoresResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of stores exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListStoresResponse.php#L92)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
##### getStores
```php
public function getStores(): OpenFGA\Models\Collections\StoresInterface
```
Get the collection of stores. Returns a type-safe collection containing the store objects from the current page of results. Each store includes its metadata such as ID, name, and timestamps.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListStoresResponse.php#L101)
###### Returns
[`StoresInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/StoresInterface.md) — The collection of stores
##### schema
*<small>Implements Responses\ListStoresResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for store listing response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListStoresResponseInterface.php#L33)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ListStoresResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListStoresResponseInterface.md -->
### ListStoresResponseInterface
Interface for stores listing response objects. This interface defines the contract for responses returned when listing authorization stores in OpenFGA. The response includes a collection of stores and pagination support for handling large numbers of stores efficiently. Store listing is useful for administrative operations, allowing you to discover and manage all stores within your OpenFGA instance.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getStores()`](#getstores)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListStoresResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListStoresResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListStoresResponse.md) (implementation)
- [ListStoresRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListStoresRequestInterface.md) (request)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of stores exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListStoresResponseInterface.php#L44)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
##### getStores
```php
public function getStores(): StoresInterface
```
Get the collection of stores. Returns a type-safe collection containing the store objects from the current page of results. Each store includes its metadata such as ID, name, and timestamps.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListStoresResponseInterface.php#L54)
###### Returns
[`StoresInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/StoresInterface.md) — The collection of stores
<!-- End of evansims/openfga-php/docs/API/Responses/ListStoresResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListTupleChangesResponse.md -->
### ListTupleChangesResponse
Response containing a paginated list of tuple changes from the store. This response provides a collection of tuple changes (additions, deletions) along with pagination information for retrieving additional pages of results. Use this to track the history of relationship changes in your authorization store.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getChanges()`](#getchanges)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListTupleChangesResponse.php)
#### Implements
- [`ListTupleChangesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ListTupleChangesResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListTupleChangesResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListTupleChangesResponseInterface.md) (interface)
- [ListTupleChangesRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListTupleChangesRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ListTupleChangesResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getChanges
```php
public function getChanges(): OpenFGA\Models\Collections\TupleChangesInterface
```
Get the collection of tuple changes. Returns a type-safe collection containing the tuple change objects from the current page of results. Each change represents a modification (insert or delete) to the relationship data, including timestamps and operation details.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListTupleChangesResponse.php#L94)
###### Returns
[`TupleChangesInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleChangesInterface.md) — The collection of tuple changes
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of tuple changes exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListTupleChangesResponse.php#L103)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
##### schema
*<small>Implements Responses\ListTupleChangesResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for tuple changes listing response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListTupleChangesResponseInterface.php#L34)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ListTupleChangesResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListTupleChangesResponseInterface.md -->
### ListTupleChangesResponseInterface
Interface for tuple changes listing response objects. This interface defines the contract for responses returned when listing changes to relationship tuples in OpenFGA. The response includes a collection of tuple changes and pagination support for handling large change sets efficiently. Tuple change listing is essential for auditing authorization modifications, implementing change feeds, and tracking the evolution of relationship data over time.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getChanges()`](#getchanges)
- [`getContinuationToken()`](#getcontinuationtoken)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListTupleChangesResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListTupleChangesResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListTupleChangesResponse.md) (implementation)
- [ListTupleChangesRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListTupleChangesRequestInterface.md) (request)
#### Methods
##### getChanges
```php
public function getChanges(): TupleChangesInterface
```
Get the collection of tuple changes. Returns a type-safe collection containing the tuple change objects from the current page of results. Each change represents a modification (insert or delete) to the relationship data, including timestamps and operation details.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListTupleChangesResponseInterface.php#L45)
###### Returns
[`TupleChangesInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleChangesInterface.md) — The collection of tuple changes
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of tuple changes exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListTupleChangesResponseInterface.php#L56)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
<!-- End of evansims/openfga-php/docs/API/Responses/ListTupleChangesResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListUsersResponse.md -->
### ListUsersResponse
Response containing a list of users that have a specific relationship with an object. This response provides a collection of users (including user objects, usersets, and typed wildcards) that have the specified relationship with the target object. Use this to discover who has access to resources in your authorization system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getUsers()`](#getusers)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListUsersResponse.php)
#### Implements
- [`ListUsersResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ListUsersResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListUsersResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ListUsersResponseInterface.md) (interface)
- [ListUsersRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ListUsersRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ListUsersResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getUsers
```php
public function getUsers(): OpenFGA\Models\Collections\UsersInterface
```
Get the collection of users with the specified relationship. Returns a type-safe collection containing the user objects that have the queried relationship with the specified object. Each user represents an entity that has been granted the specified permission or relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListUsersResponse.php#L97)
###### Returns
[`UsersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersInterface.md) — The collection of users with the relationship
##### schema
*<small>Implements Responses\ListUsersResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for user listing response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListUsersResponseInterface.php#L35)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ListUsersResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ListUsersResponseInterface.md -->
### ListUsersResponseInterface
Interface for user listing response objects. This interface defines the contract for responses returned when listing users that have a specific relationship with an object in OpenFGA. This is the inverse of permission checking - instead of asking "can this user access this object?," it asks "which users can access this object?" User listing is particularly useful for building administrative interfaces, access reports, and user management features that need to display who has access to specific resources.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getUsers()`](#getusers)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListUsersResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ListUsersResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ListUsersResponse.md) (implementation)
- [ListUsersRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ListUsersRequestInterface.md) (request)
#### Methods
##### getUsers
```php
public function getUsers(): UsersInterface
```
Get the collection of users with the specified relationship. Returns a type-safe collection containing the user objects that have the queried relationship with the specified object. Each user represents an entity that has been granted the specified permission or relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ListUsersResponseInterface.php#L46)
###### Returns
[`UsersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UsersInterface.md) — The collection of users with the relationship
<!-- End of evansims/openfga-php/docs/API/Responses/ListUsersResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/README.md -->
## Responses
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Responses
Response objects containing API results and metadata.
**Total Components:** 37
### Interfaces
| Name | Description |
|------|-------------|
| [`BatchCheckResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckResponseInterface.md) | Response containing the results of a batch authorization check. This response contains a map of c... |
| [`CheckResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./CheckResponseInterface.md) | Interface for permission check response objects. This interface defines the contract for response... |
| [`CreateAuthorizationModelResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./CreateAuthorizationModelResponseInterface.md) | Interface for authorization model creation response objects. This interface defines the contract ... |
| [`CreateStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./CreateStoreResponseInterface.md) | Interface for store creation response objects. This interface defines the contract for responses ... |
| [`DeleteStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./DeleteStoreResponseInterface.md) | Interface for store deletion response objects. This interface defines the contract for responses ... |
| [`ExpandResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ExpandResponseInterface.md) | Interface for relationship expansion response objects. This interface defines the contract for re... |
| [`GetAuthorizationModelResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./GetAuthorizationModelResponseInterface.md) | Interface for authorization model retrieval response objects. This interface defines the contract... |
| [`GetStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./GetStoreResponseInterface.md) | Interface for store retrieval response objects. This interface defines the contract for responses... |
| [`ListAuthorizationModelsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ListAuthorizationModelsResponseInterface.md) | Interface for authorization models listing response objects. This interface defines the contract ... |
| [`ListObjectsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ListObjectsResponseInterface.md) | Interface for object listing response objects. This interface defines the contract for responses ... |
| [`ListStoresResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ListStoresResponseInterface.md) | Interface for stores listing response objects. This interface defines the contract for responses ... |
| [`ListTupleChangesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ListTupleChangesResponseInterface.md) | Interface for tuple changes listing response objects. This interface defines the contract for res... |
| [`ListUsersResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ListUsersResponseInterface.md) | Interface for user listing response objects. This interface defines the contract for responses re... |
| [`ReadAssertionsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ReadAssertionsResponseInterface.md) | Interface for assertions reading response objects. This interface defines the contract for respon... |
| [`ReadTuplesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ReadTuplesResponseInterface.md) | Interface for tuple reading response objects. This interface defines the contract for responses r... |
| [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./ResponseInterface.md) | Base interface for all OpenFGA API response objects. This interface establishes the foundational ... |
| [`StreamedListObjectsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./StreamedListObjectsResponseInterface.md) | Response interface for streaming objects that a user has a specific relationship with. This respo... |
| [`WriteAssertionsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./WriteAssertionsResponseInterface.md) | Interface for assertions writing response objects. This interface defines the contract for respon... |
| [`WriteTuplesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./WriteTuplesResponseInterface.md) | Interface for tuple writing response objects. This interface defines the contract for responses r... |
### Classes
| Name | Description |
|------|-------------|
| [`BatchCheckResponse`](https://github.com/evansims/openfga-php/blob/main/./BatchCheckResponse.md) | Response containing the results of a batch authorization check. This response contains a map of c... |
| [`CheckResponse`](https://github.com/evansims/openfga-php/blob/main/./CheckResponse.md) | Response containing the result of an authorization check. This response indicates whether a user ... |
| [`CreateAuthorizationModelResponse`](https://github.com/evansims/openfga-php/blob/main/./CreateAuthorizationModelResponse.md) | Response confirming successful creation of a new authorization model. This response provides the ... |
| [`CreateStoreResponse`](https://github.com/evansims/openfga-php/blob/main/./CreateStoreResponse.md) | Response confirming successful creation of a new store. This response provides the details of the... |
| [`DeleteStoreResponse`](https://github.com/evansims/openfga-php/blob/main/./DeleteStoreResponse.md) | Response confirming successful deletion of a store. This response is returned when a store has be... |
| [`ExpandResponse`](https://github.com/evansims/openfga-php/blob/main/./ExpandResponse.md) | Response containing the expanded userset tree for a relationship query. This response provides a ... |
| [`GetAuthorizationModelResponse`](https://github.com/evansims/openfga-php/blob/main/./GetAuthorizationModelResponse.md) | Response containing a specific authorization model from the store. This response provides the com... |
| [`GetStoreResponse`](https://github.com/evansims/openfga-php/blob/main/./GetStoreResponse.md) | Response containing detailed information about a specific store. This response provides comprehen... |
| [`ListAuthorizationModelsResponse`](https://github.com/evansims/openfga-php/blob/main/./ListAuthorizationModelsResponse.md) | Response containing a paginated list of authorization models. This response provides access to au... |
| [`ListObjectsResponse`](https://github.com/evansims/openfga-php/blob/main/./ListObjectsResponse.md) | Response containing a list of objects that a user has a specific relationship with. This response... |
| [`ListStoresResponse`](https://github.com/evansims/openfga-php/blob/main/./ListStoresResponse.md) | Response containing a paginated list of available stores. This response provides access to stores... |
| [`ListTupleChangesResponse`](https://github.com/evansims/openfga-php/blob/main/./ListTupleChangesResponse.md) | Response containing a paginated list of tuple changes from the store. This response provides a co... |
| [`ListUsersResponse`](https://github.com/evansims/openfga-php/blob/main/./ListUsersResponse.md) | Response containing a list of users that have a specific relationship with an object. This respon... |
| [`ReadAssertionsResponse`](https://github.com/evansims/openfga-php/blob/main/./ReadAssertionsResponse.md) | Response containing test assertions associated with an authorization model. This response provide... |
| [`ReadTuplesResponse`](https://github.com/evansims/openfga-php/blob/main/./ReadTuplesResponse.md) | Response containing a paginated list of relationship tuples. This response provides access to rel... |
| [`StreamedListObjectsResponse`](https://github.com/evansims/openfga-php/blob/main/./StreamedListObjectsResponse.md) | Response containing streaming objects that a user has a specific relationship with. This response... |
| [`WriteAssertionsResponse`](https://github.com/evansims/openfga-php/blob/main/./WriteAssertionsResponse.md) | Response confirming successful writing of test assertions. This response indicates that test asse... |
| [`WriteTuplesResponse`](https://github.com/evansims/openfga-php/blob/main/./WriteTuplesResponse.md) | Response for tuple writing operations supporting both transactional and non-transactional modes. ... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Responses/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ReadAssertionsResponse.md -->
### ReadAssertionsResponse
Response containing test assertions associated with an authorization model. This response provides access to test assertions that validate authorization model behavior. These assertions define expected outcomes for specific authorization scenarios and help ensure model correctness.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getAssertions()`](#getassertions)
- [`getModel()`](#getmodel)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadAssertionsResponse.php)
#### Implements
- [`ReadAssertionsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ReadAssertionsResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ReadAssertionsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ReadAssertionsResponseInterface.md) (interface)
- [ReadAssertionsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ReadAssertionsRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ReadAssertionsResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getAssertions
```php
public function getAssertions(): ?OpenFGA\Models\Collections\AssertionsInterface
```
Get the collection of assertions from the authorization model. Returns a type-safe collection containing the assertion objects associated with the authorization model. Each assertion defines a test case with expected permission check results for validating model behavior.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadAssertionsResponse.php#L95)
###### Returns
[`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | `null` — The collection of assertions, or null if no assertions are defined
##### getModel
```php
public function getModel(): string
```
Get the authorization model identifier for these assertions. Returns the unique identifier of the authorization model that contains these assertions. This ties the assertions to a specific model version for validation and testing purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadAssertionsResponse.php#L104)
###### Returns
`string` — The authorization model identifier
##### schema
*<small>Implements Responses\ReadAssertionsResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for assertions reading response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadAssertionsResponseInterface.php#L34)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ReadAssertionsResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ReadAssertionsResponseInterface.md -->
### ReadAssertionsResponseInterface
Interface for assertions reading response objects. This interface defines the contract for responses returned when reading assertions from an OpenFGA authorization model. Assertions are test cases that validate the behavior of an authorization model by specifying expected permission check results. Assertion reading is used for testing authorization models, validating model behavior, and ensuring that permission logic works as expected during development and deployment.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAssertions()`](#getassertions)
- [`getModel()`](#getmodel)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadAssertionsResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ReadAssertionsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ReadAssertionsResponse.md) (implementation)
- [ReadAssertionsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ReadAssertionsRequestInterface.md) (request)
#### Methods
##### getAssertions
```php
public function getAssertions(): AssertionsInterface|null
```
Get the collection of assertions from the authorization model. Returns a type-safe collection containing the assertion objects associated with the authorization model. Each assertion defines a test case with expected permission check results for validating model behavior.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadAssertionsResponseInterface.php#L45)
###### Returns
[`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | `null` — The collection of assertions, or null if no assertions are defined
##### getModel
```php
public function getModel(): string
```
Get the authorization model identifier for these assertions. Returns the unique identifier of the authorization model that contains these assertions. This ties the assertions to a specific model version for validation and testing purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadAssertionsResponseInterface.php#L56)
###### Returns
`string` — The authorization model identifier
<!-- End of evansims/openfga-php/docs/API/Responses/ReadAssertionsResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ReadTuplesResponse.md -->
### ReadTuplesResponse
Response containing a paginated list of relationship tuples. This response provides access to relationship tuples that match the query criteria, with pagination support for handling large result sets. Each tuple represents a specific relationship between a user and an object.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getTuples()`](#gettuples)
- [`schema()`](#schema)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadTuplesResponse.php)
#### Implements
- [`ReadTuplesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ReadTuplesResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ReadTuplesResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/ReadTuplesResponseInterface.md) (interface)
- [ReadTuplesRequest](https://github.com/evansims/openfga-php/blob/main/Requests/ReadTuplesRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\ReadTuplesResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getContinuationToken
```php
public function getContinuationToken(): ?string
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of matching tuples exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadTuplesResponse.php#L95)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
##### getTuples
```php
public function getTuples(): OpenFGA\Models\Collections\TuplesInterface
```
Get the collection of relationship tuples. Returns a type-safe collection containing the tuple objects that match the read query criteria. Each tuple represents a relationship between a user and an object through a specific relation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadTuplesResponse.php#L104)
###### Returns
[`TuplesInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TuplesInterface.md) — The collection of relationship tuples
##### schema
*<small>Implements Responses\ReadTuplesResponseInterface</small>*
```php
public function schema(): SchemaInterface
```
Get the schema definition for this response. Returns the schema that defines the structure and validation rules for tuple reading response data, ensuring consistent parsing and validation of API responses.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadTuplesResponseInterface.php#L33)
###### Returns
`SchemaInterface` — The schema definition for response validation
<!-- End of evansims/openfga-php/docs/API/Responses/ReadTuplesResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ReadTuplesResponseInterface.md -->
### ReadTuplesResponseInterface
Interface for tuple reading response objects. This interface defines the contract for responses returned when reading relationship tuples from OpenFGA. The response includes a collection of tuples matching the query criteria and pagination support for handling large result sets efficiently. Tuple reading is essential for querying existing relationships, auditing authorization data, and implementing administrative interfaces for relationship management.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getContinuationToken()`](#getcontinuationtoken)
- [`getTuples()`](#gettuples)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadTuplesResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [ReadTuplesResponse](https://github.com/evansims/openfga-php/blob/main/Responses/ReadTuplesResponse.md) (implementation)
- [ReadTuplesRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/ReadTuplesRequestInterface.md) (request)
#### Methods
##### getContinuationToken
```php
public function getContinuationToken(): string|null
```
Get the continuation token for pagination. Returns a token that can be used to retrieve the next page of results when the total number of matching tuples exceeds the page size limit. If null, there are no more results to fetch.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadTuplesResponseInterface.php#L44)
###### Returns
`string` | `null` — The continuation token for fetching more results, or null if no more pages exist
##### getTuples
```php
public function getTuples(): TuplesInterface
```
Get the collection of relationship tuples. Returns a type-safe collection containing the tuple objects that match the read query criteria. Each tuple represents a relationship between a user and an object through a specific relation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ReadTuplesResponseInterface.php#L55)
###### Returns
[`TuplesInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TuplesInterface.md) — The collection of relationship tuples
<!-- End of evansims/openfga-php/docs/API/Responses/ReadTuplesResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/ResponseInterface.md -->
### ResponseInterface
Base interface for all OpenFGA API response objects. This interface establishes the foundational contract for all response objects returned by the OpenFGA API. It defines the standard method for transforming raw HTTP responses into structured, validated response objects that applications can work with safely. All concrete response implementations must provide a way to parse HTTP responses while handling errors appropriately and validating data according to their specific schemas.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php)
#### Related Classes
- [Response](https://github.com/evansims/openfga-php/blob/main/Responses/Response.md) (implementation)
- [RequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) (request)
<!-- End of evansims/openfga-php/docs/API/Responses/ResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/StreamedListObjectsResponse.md -->
### StreamedListObjectsResponse
Response containing streaming objects that a user has a specific relationship with. This response processes a streaming HTTP response and yields object identifiers as they are received from the server. This allows for memory-efficient processing of large result sets without loading the entire dataset into memory.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getObject()`](#getobject)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/StreamedListObjectsResponse.php)
#### Implements
- [`StreamedListObjectsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/StreamedListObjectsResponseInterface.md)
#### Related Classes
- [StreamedListObjectsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/StreamedListObjectsResponseInterface.md) (interface)
- [StreamedListObjectsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/StreamedListObjectsRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\StreamedListObjectsResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): Generator<int, StreamedListObjectsResponseInterface>
```
Create a streaming response from an HTTP response. Processes the streaming HTTP response and returns a Generator that yields individual object identifiers as they are received from the server.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/StreamedListObjectsResponseInterface.php#L42)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | ---------------------------------------- |
| `$response` | `HttpResponseInterface` | The HTTP response from the API |
| `$request` | `HttpRequestInterface` | The original HTTP request |
| `$validator` | `SchemaValidatorInterface` | Schema validator for response validation |
###### Returns
`Generator`<`int`, [`StreamedListObjectsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/StreamedListObjectsResponseInterface.md)> — Generator yielding response objects
##### getObject
```php
public function getObject(): string
```
Get a single object identifier from a streamed response chunk.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/StreamedListObjectsResponse.php#L128)
###### Returns
`string` — The object identifier
<!-- End of evansims/openfga-php/docs/API/Responses/StreamedListObjectsResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/StreamedListObjectsResponseInterface.md -->
### StreamedListObjectsResponseInterface
Response interface for streaming objects that a user has a specific relationship with. This response provides a Generator that yields object identifiers as they are streamed from the server. This allows for memory-efficient processing of large result sets without loading the entire dataset into memory at once.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getObject()`](#getobject)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/StreamedListObjectsResponseInterface.php)
#### Related Classes
- [StreamedListObjectsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/StreamedListObjectsResponse.md) (implementation)
- [StreamedListObjectsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/StreamedListObjectsRequestInterface.md) (request)
#### Methods
##### getObject
```php
public function getObject(): string
```
Get a single object identifier from a streamed response chunk.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/StreamedListObjectsResponseInterface.php#L53)
###### Returns
`string` — The object identifier
<!-- End of evansims/openfga-php/docs/API/Responses/StreamedListObjectsResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/WriteAssertionsResponse.md -->
### WriteAssertionsResponse
Response confirming successful writing of test assertions. This response indicates that test assertions have been successfully stored for an authorization model. The assertions can now be used to validate that the model behaves correctly in various authorization scenarios.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteAssertionsResponse.php)
#### Implements
- [`WriteAssertionsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/WriteAssertionsResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [WriteAssertionsResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/WriteAssertionsResponseInterface.md) (interface)
- [WriteAssertionsRequest](https://github.com/evansims/openfga-php/blob/main/Requests/WriteAssertionsRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\WriteAssertionsResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
<!-- End of evansims/openfga-php/docs/API/Responses/WriteAssertionsResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/WriteAssertionsResponseInterface.md -->
### WriteAssertionsResponseInterface
Interface for assertions writing response objects. This interface defines the contract for responses returned when writing assertions to an OpenFGA authorization model. Assertion writing responses typically contain no additional data beyond the successful HTTP status, indicating that the assertions have been successfully stored. Assertions are test cases that validate the behavior of authorization models by specifying expected permission check results, helping ensure model correctness.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteAssertionsResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [WriteAssertionsResponse](https://github.com/evansims/openfga-php/blob/main/Responses/WriteAssertionsResponse.md) (implementation)
- [WriteAssertionsRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/WriteAssertionsRequestInterface.md) (request)
<!-- End of evansims/openfga-php/docs/API/Responses/WriteAssertionsResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/WriteTuplesResponse.md -->
### WriteTuplesResponse
Response for tuple writing operations supporting both transactional and non-transactional modes. This response handles results from both transactional writes (all-or-nothing) and non-transactional writes (independent operations with detailed tracking).
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromResponse()`](#fromresponse)
- [`getErrors()`](#geterrors)
- [`getFailedChunks()`](#getfailedchunks)
- [`getFirstError()`](#getfirsterror)
- [`getSuccessRate()`](#getsuccessrate)
- [`getSuccessfulChunks()`](#getsuccessfulchunks)
- [`getTotalChunks()`](#gettotalchunks)
- [`getTotalOperations()`](#gettotaloperations)
- [`isCompleteFailure()`](#iscompletefailure)
- [`isCompleteSuccess()`](#iscompletesuccess)
- [`isPartialSuccess()`](#ispartialsuccess)
- [`isTransactional()`](#istransactional)
- [`throwOnFailure()`](#throwonfailure)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php)
#### Implements
- [`WriteTuplesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/WriteTuplesResponseInterface.md)
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [WriteTuplesResponseInterface](https://github.com/evansims/openfga-php/blob/main/Responses/WriteTuplesResponseInterface.md) (interface)
- [WriteTuplesRequest](https://github.com/evansims/openfga-php/blob/main/Requests/WriteTuplesRequest.md) (request)
#### Methods
##### fromResponse
*<small>Implements Responses\WriteTuplesResponseInterface</small>*
```php
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
```
Create a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/ResponseInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | --------------------------------------------------------- |
| `$response` | `HttpResponseInterface` | The raw HTTP response from the OpenFGA API |
| `$request` | `HttpRequestInterface` | The original HTTP request that generated this response |
| `$validator` | `SchemaValidatorInterface` | Schema validator for parsing and validating response data |
###### Returns
`static` — The parsed and validated response instance containing the API response data
##### getErrors
```php
public function getErrors(): array
```
Get all errors that occurred during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L80)
###### Returns
`array` — Array of exceptions from failed operations
##### getFailedChunks
```php
public function getFailedChunks(): int
```
Get the number of failed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L89)
###### Returns
`int` — The number of failed chunks
##### getFirstError
```php
public function getFirstError(): ?Throwable
```
Get the first error that occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L98)
###### Returns
`Throwable` | `null` — The first error, or null if no errors
##### getSuccessRate
```php
public function getSuccessRate(): float
```
Calculate the success rate of the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L116)
###### Returns
`float` — Success rate between 0.0 and 1.0
##### getSuccessfulChunks
```php
public function getSuccessfulChunks(): int
```
Get the number of successfully processed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L107)
###### Returns
`int` — The number of successful chunks
##### getTotalChunks
```php
public function getTotalChunks(): int
```
Get the total number of chunks processed (non-transactional mode).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L129)
###### Returns
`int` — The number of chunks, or 1 for transactional mode
##### getTotalOperations
```php
public function getTotalOperations(): int
```
Get the total number of tuple operations processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L138)
###### Returns
`int` — The total number of write and delete operations
##### isCompleteFailure
```php
public function isCompleteFailure(): bool
```
Check if all operations failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L147)
###### Returns
`bool` — True if all operations failed
##### isCompleteSuccess
```php
public function isCompleteSuccess(): bool
```
Check if all operations completed successfully.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L156)
###### Returns
`bool` — True if all operations succeeded
##### isPartialSuccess
```php
public function isPartialSuccess(): bool
```
Check if some operations succeeded and some failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L165)
###### Returns
`bool` — True if partial success (non-transactional mode only)
##### isTransactional
```php
public function isTransactional(): bool
```
Check if the operation was executed in transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L174)
###### Returns
`bool` — True if transactional, false if non-transactional
##### throwOnFailure
```php
public function throwOnFailure(): void
```
Throw an exception if any operations failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponse.php#L183)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Responses/WriteTuplesResponse.md -->
<!-- Source: evansims/openfga-php/docs/API/Responses/WriteTuplesResponseInterface.md -->
### WriteTuplesResponseInterface
Interface for tuple writing response objects. This interface defines the contract for responses returned when writing relationship tuples to an OpenFGA store. The response handles both transactional and non-transactional write modes, providing appropriate feedback for each operation type. In transactional mode, all changes succeed or fail together. In non-transactional mode, operations are processed independently with detailed success/failure tracking.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getErrors()`](#geterrors)
- [`getFailedChunks()`](#getfailedchunks)
- [`getFirstError()`](#getfirsterror)
- [`getSuccessRate()`](#getsuccessrate)
- [`getSuccessfulChunks()`](#getsuccessfulchunks)
- [`getTotalChunks()`](#gettotalchunks)
- [`getTotalOperations()`](#gettotaloperations)
- [`isCompleteFailure()`](#iscompletefailure)
- [`isCompleteSuccess()`](#iscompletesuccess)
- [`isPartialSuccess()`](#ispartialsuccess)
- [`isTransactional()`](#istransactional)
- [`throwOnFailure()`](#throwonfailure)
</details>
#### Namespace
`OpenFGA\Responses`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php)
#### Implements
- [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/ResponseInterface.md)
#### Related Classes
- [WriteTuplesResponse](https://github.com/evansims/openfga-php/blob/main/Responses/WriteTuplesResponse.md) (implementation)
- [WriteTuplesRequestInterface](https://github.com/evansims/openfga-php/blob/main/Requests/WriteTuplesRequestInterface.md) (request)
#### Methods
##### getErrors
```php
public function getErrors(): array<Throwable>
```
Get all errors that occurred during processing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L28)
###### Returns
`array<`Throwable`>` — Array of exceptions from failed operations
##### getFailedChunks
```php
public function getFailedChunks(): int
```
Get the number of failed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L35)
###### Returns
`int` — The number of failed chunks
##### getFirstError
```php
public function getFirstError(): Throwable|null
```
Get the first error that occurred.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L42)
###### Returns
`Throwable` | `null` — The first error, or null if no errors
##### getSuccessRate
```php
public function getSuccessRate(): float
```
Calculate the success rate of the operation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L56)
###### Returns
`float` — Success rate between 0.0 and 1.0
##### getSuccessfulChunks
```php
public function getSuccessfulChunks(): int
```
Get the number of successfully processed chunks.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L49)
###### Returns
`int` — The number of successful chunks
##### getTotalChunks
```php
public function getTotalChunks(): int
```
Get the total number of chunks processed (non-transactional mode).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L63)
###### Returns
`int` — The number of chunks, or 1 for transactional mode
##### getTotalOperations
```php
public function getTotalOperations(): int
```
Get the total number of tuple operations processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L70)
###### Returns
`int` — The total number of write and delete operations
##### isCompleteFailure
```php
public function isCompleteFailure(): bool
```
Check if all operations failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L77)
###### Returns
`bool` — True if all operations failed
##### isCompleteSuccess
```php
public function isCompleteSuccess(): bool
```
Check if all operations completed successfully.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L84)
###### Returns
`bool` — True if all operations succeeded
##### isPartialSuccess
```php
public function isPartialSuccess(): bool
```
Check if some operations succeeded and some failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L91)
###### Returns
`bool` — True if partial success (non-transactional mode only)
##### isTransactional
```php
public function isTransactional(): bool
```
Check if the operation was executed in transactional mode.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L98)
###### Returns
`bool` — True if transactional, false if non-transactional
##### throwOnFailure
```php
public function throwOnFailure(): void
```
Throw an exception if any operations failed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Responses/WriteTuplesResponseInterface.php#L105)
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Responses/WriteTuplesResponseInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Results/Failure.md -->
### Failure
Concrete implementation of a failed result containing an error. This class represents the failed outcome of an operation, storing the error that caused the failure and providing safe access through the Result pattern's fluent interface.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`err()`](#err)
- [`failed()`](#failed)
- [`failure()`](#failure)
- [`recover()`](#recover)
- [`rethrow()`](#rethrow)
- [`succeeded()`](#succeeded)
- [`success()`](#success)
- [`then()`](#then)
- [`unwrap()`](#unwrap)
- [`val()`](#val)
</details>
#### Namespace
`OpenFGA\Results`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php)
#### Implements
- [`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md)
- [`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/FailureInterface.md)
#### Related Classes
- [FailureInterface](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) (interface)
#### Methods
##### err
```php
public function err(): Throwable
```
Retrieves the error from a failed result. This method should only be called on Failure results. Use failed() to check the result type before calling this method to avoid exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L37)
###### Returns
`Throwable` — The error that caused the failure
##### failed
```php
public function failed(): bool
```
Determines if this result represents a failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L46)
###### Returns
`bool` — True if this is a Failure result, false if it's a Success
##### failure
```php
public function failure(callable $fn): OpenFGA\Results\ResultInterface
```
Executes a callback when the result is a failure and continues the chain. The callback receives the error as its parameter and is only executed for Failure results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L55)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### recover
```php
public function recover(callable $fn): OpenFGA\Results\ResultInterface
```
Recovers from a failure by transforming it into a success or different failure. The callback is only executed for Failure results and can return either a new Result or a plain value (which becomes a Success). Success results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L68)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The recovered result or original success
##### rethrow
```php
public function rethrow(?Throwable $throwable = NULL): OpenFGA\Results\ResultInterface
```
Throws the contained error or continues the chain. For Failure results, this throws either the provided throwable or the contained error. For Success results, this method has no effect and returns the result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L84)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------- | ---------------------------------------------------------- |
| `$throwable` | `Throwable` | `null` | Optional throwable to throw instead of the contained error |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### succeeded
```php
public function succeeded(): bool
```
Determines if this result represents a success.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L93)
###### Returns
`bool` — True if this is a Success result, false if it's a Failure
##### success
```php
public function success(callable $fn): OpenFGA\Results\ResultInterface
```
Executes a callback when the result is a success and continues the chain. The callback receives the success value (specific response interface) as its parameter and is only executed for Success results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L102)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### then
```php
public function then(callable $fn): OpenFGA\Results\ResultInterface
```
Transforms a successful result using a callback and continues the chain. The callback is only executed for Success results and receives the specific response interface as its parameter. It can return either a new Result or a plain value (which becomes a Success). Failure results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L111)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The transformed result or original failure
##### unwrap
```php
public function unwrap(?callable $fn = NULL): mixed
```
Extracts the value from the result or applies a transformation. Without a callback, this returns the success value (specific response interface) or throws the failure error. With a callback, the function is called with either the response interface or failure error, and its return value is returned instead of throwing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Result.php#L22)
###### Parameters
| Name | Type | Description |
| ----- | ------------------------ | ----------- |
| `$fn` | `callable` | `null` | |
###### Returns
`mixed` — The response interface, callback result, or throws the error
##### val
```php
public function val(): never
```
Retrieves the value from a successful result. This method should only be called on Success results. Use succeeded() to check the result type before calling this method to avoid exceptions. Returns the specific response interface documented in the calling method's @return annotation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Failure.php#L124)
###### Returns
`never` — The response interface (for example CheckResponseInterface, StoreInterface)
<!-- End of evansims/openfga-php/docs/API/Results/Failure.md -->
<!-- Source: evansims/openfga-php/docs/API/Results/FailureInterface.md -->
### FailureInterface
Represents a failed result containing an error. Failure results indicate that an operation encountered an error and contain the throwable that caused the failure. They provide safe access to error information while maintaining compatibility with the Result pattern's fluent interface. Failure results behave predictably in all Result operations: - `succeeded()` always returns false - `failed()` always returns true - `err()` returns the contained error safely - `val()` throws since failures have no values - `failure()` executes callbacks with the error - `success()` skips callbacks and returns unchanged - `then()` skips transformations and returns unchanged - `recover()` applies recovery functions to the error - `rethrow()` throws the error or provided throwable
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`err()`](#err)
- [`failed()`](#failed)
- [`failure()`](#failure)
- [`recover()`](#recover)
- [`rethrow()`](#rethrow)
- [`succeeded()`](#succeeded)
- [`success()`](#success)
- [`then()`](#then)
- [`unwrap()`](#unwrap)
- [`val()`](#val)
</details>
#### Namespace
`OpenFGA\Results`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Results/FailureInterface.php)
#### Implements
- [`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md)
#### Related Classes
- [Failure](https://github.com/evansims/openfga-php/blob/main/Results/Failure.md) (implementation)
#### Methods
##### err
```php
public function err(): Throwable
```
Retrieves the error from a failed result. This method should only be called on Failure results. Use failed() to check the result type before calling this method to avoid exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L71)
###### Returns
`Throwable` — The error that caused the failure
##### failed
```php
public function failed(): bool
```
Determines if this result represents a failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L78)
###### Returns
`bool` — True if this is a Failure result, false if it's a Success
##### failure
```php
public function failure(callable $fn): ResultInterface
```
Executes a callback when the result is a failure and continues the chain. The callback receives the error as its parameter and is only executed for Failure results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### recover
```php
public function recover(callable $fn): ResultInterface
```
Recovers from a failure by transforming it into a success or different failure. The callback is only executed for Failure results and can return either a new Result or a plain value (which becomes a Success). Success results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L100)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The recovered result or original success
##### rethrow
```php
public function rethrow(Throwable|null $throwable = NULL): ResultInterface
```
Throws the contained error or continues the chain. For Failure results, this throws either the provided throwable or the contained error. For Success results, this method has no effect and returns the result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L114)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------- | ---------------------------------------------------------- |
| `$throwable` | `Throwable` | `null` | Optional throwable to throw instead of the contained error |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### succeeded
```php
public function succeeded(): bool
```
Determines if this result represents a success.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L121)
###### Returns
`bool` — True if this is a Success result, false if it's a Failure
##### success
```php
public function success(callable $fn): ResultInterface
```
Executes a callback when the result is a success and continues the chain. The callback receives the success value (specific response interface) as its parameter and is only executed for Success results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L132)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### then
```php
public function then(callable $fn): ResultInterface
```
Transforms a successful result using a callback and continues the chain. The callback is only executed for Success results and receives the specific response interface as its parameter. It can return either a new Result or a plain value (which becomes a Success). Failure results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L144)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The transformed result or original failure
##### unwrap
```php
public function unwrap(?callable $fn = NULL): mixed
```
Extracts the value from the result or applies a transformation. Without a callback, this returns the success value (specific response interface) or throws the failure error. With a callback, the function is called with either the response interface or failure error, and its return value is returned instead of throwing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L159)
###### Parameters
| Name | Type | Description |
| ----- | ------------------------ | ----------- |
| `$fn` | `callable` | `null` | |
###### Returns
`mixed` — The response interface, callback result, or throws the error
##### val
```php
public function val(): mixed
```
Retrieves the value from a successful result. This method should only be called on Success results. Use succeeded() to check the result type before calling this method to avoid exceptions. Returns the specific response interface documented in the calling method's @return annotation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L172)
###### Returns
`mixed` — The response interface (for example CheckResponseInterface, StoreInterface)
<!-- End of evansims/openfga-php/docs/API/Results/FailureInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Results/README.md -->
## Results
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Results
Result pattern implementation for functional error handling without exceptions.
**Total Components:** 5
### Interfaces
| Name | Description |
|------|-------------|
| [`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/./FailureInterface.md) | Represents a failed result containing an error. Failure results indicate that an operation encoun... |
| [`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/./ResultInterface.md) | Represents the result of an operation that can either succeed or fail. The Result pattern provide... |
| [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/./SuccessInterface.md) | Represents a successful result containing a value. Success results indicate that an operation com... |
### Classes
| Name | Description |
|------|-------------|
| [`Failure`](https://github.com/evansims/openfga-php/blob/main/./Failure.md) | Concrete implementation of a failed result containing an error. This class represents the failed ... |
| [`Success`](https://github.com/evansims/openfga-php/blob/main/./Success.md) | Concrete implementation of a successful result containing a value. This class represents the succ... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Results/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Results/ResultInterface.md -->
### ResultInterface
Represents the result of an operation that can either succeed or fail. The Result pattern provides a safe and composable way to handle operations that might fail without using exceptions for control flow. Results can be chained together using fluent methods, making error handling explicit and predictable. ## Working with Result Types Each Result contains either a success value (specific response interface) or a failure error (Throwable). The specific types are documented in each method's @return annotation. ## Common Usage Patterns ### Simple Value Extraction ```php $result = $client->check($store, $model, $tupleKey); if ($result->succeeded()) { $response = $result->val(); // Returns CheckResponseInterface $allowed = $response->getAllowed(); } ``` ### Fluent Error Handling ```php $allowed = $client->check($store, $model, $tupleKey) ->success(fn($response) => logger()->info('Check succeeded')) ->failure(fn($error) => logger()->error('Check failed: ' . $error->getMessage())) ->then(fn($response) => $response->getAllowed()) ->recover(fn($error) => false) // Default to not allowed on error ->unwrap(); ``` ### Safe Unwrapping with Default Values ```php $store = $client->getStore($storeId) ->unwrap(fn($result) => $result instanceof StoreInterface ? $result : null); ``` ### Transforming Results ```php $storeNames = $client->listStores() ->then(fn($response) => array_map( fn($store) => $store->getName(), $response->getStores()->toArray() )) ->unwrap(); ```
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`err()`](#err)
- [`failed()`](#failed)
- [`failure()`](#failure)
- [`recover()`](#recover)
- [`rethrow()`](#rethrow)
- [`succeeded()`](#succeeded)
- [`success()`](#success)
- [`then()`](#then)
- [`unwrap()`](#unwrap)
- [`val()`](#val)
</details>
#### Namespace
`OpenFGA\Results`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php)
#### Related Classes
- [Result](https://github.com/evansims/openfga-php/blob/main/Results/Result.md) (implementation)
#### Methods
##### err
```php
public function err(): Throwable
```
Retrieves the error from a failed result. This method should only be called on Failure results. Use failed() to check the result type before calling this method to avoid exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L71)
###### Returns
`Throwable` — The error that caused the failure
##### failed
```php
public function failed(): bool
```
Determines if this result represents a failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L78)
###### Returns
`bool` — True if this is a Failure result, false if it's a Success
##### failure
```php
public function failure(callable $fn): ResultInterface
```
Executes a callback when the result is a failure and continues the chain. The callback receives the error as its parameter and is only executed for Failure results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### recover
```php
public function recover(callable $fn): ResultInterface
```
Recovers from a failure by transforming it into a success or different failure. The callback is only executed for Failure results and can return either a new Result or a plain value (which becomes a Success). Success results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L100)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The recovered result or original success
##### rethrow
```php
public function rethrow(Throwable|null $throwable = NULL): ResultInterface
```
Throws the contained error or continues the chain. For Failure results, this throws either the provided throwable or the contained error. For Success results, this method has no effect and returns the result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L114)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------- | ---------------------------------------------------------- |
| `$throwable` | `Throwable` | `null` | Optional throwable to throw instead of the contained error |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### succeeded
```php
public function succeeded(): bool
```
Determines if this result represents a success.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L121)
###### Returns
`bool` — True if this is a Success result, false if it's a Failure
##### success
```php
public function success(callable $fn): ResultInterface
```
Executes a callback when the result is a success and continues the chain. The callback receives the success value (specific response interface) as its parameter and is only executed for Success results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L132)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### then
```php
public function then(callable $fn): ResultInterface
```
Transforms a successful result using a callback and continues the chain. The callback is only executed for Success results and receives the specific response interface as its parameter. It can return either a new Result or a plain value (which becomes a Success). Failure results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L144)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The transformed result or original failure
##### unwrap
```php
public function unwrap(?callable $fn = NULL): mixed
```
Extracts the value from the result or applies a transformation. Without a callback, this returns the success value (specific response interface) or throws the failure error. With a callback, the function is called with either the response interface or failure error, and its return value is returned instead of throwing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L159)
###### Parameters
| Name | Type | Description |
| ----- | ------------------------ | ----------- |
| `$fn` | `callable` | `null` | |
###### Returns
`mixed` — The response interface, callback result, or throws the error
##### val
```php
public function val(): mixed
```
Retrieves the value from a successful result. This method should only be called on Success results. Use succeeded() to check the result type before calling this method to avoid exceptions. Returns the specific response interface documented in the calling method's @return annotation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L172)
###### Returns
`mixed` — The response interface (for example CheckResponseInterface, StoreInterface)
<!-- End of evansims/openfga-php/docs/API/Results/ResultInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Results/Success.md -->
### Success
Concrete implementation of a successful result containing a value. This class represents the successful outcome of an operation, storing the resulting value and providing type-safe access through the Result pattern's fluent interface.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`err()`](#err)
- [`failed()`](#failed)
- [`failure()`](#failure)
- [`recover()`](#recover)
- [`rethrow()`](#rethrow)
- [`succeeded()`](#succeeded)
- [`success()`](#success)
- [`then()`](#then)
- [`unwrap()`](#unwrap)
- [`val()`](#val)
</details>
#### Namespace
`OpenFGA\Results`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php)
#### Implements
- [`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md)
- [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/SuccessInterface.md)
#### Related Classes
- [SuccessInterface](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) (interface)
#### Methods
##### err
```php
public function err(): never
```
Retrieves the error from a failed result. This method should only be called on Failure results. Use failed() to check the result type before calling this method to avoid exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L41)
###### Returns
`never` — The error that caused the failure
##### failed
```php
public function failed(): bool
```
Determines if this result represents a failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L50)
###### Returns
`bool` — True if this is a Failure result, false if it's a Success
##### failure
```php
public function failure(callable $fn): OpenFGA\Results\ResultInterface
```
Executes a callback when the result is a failure and continues the chain. The callback receives the error as its parameter and is only executed for Failure results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L59)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### recover
```php
public function recover(callable $fn): OpenFGA\Results\ResultInterface
```
Recovers from a failure by transforming it into a success or different failure. The callback is only executed for Failure results and can return either a new Result or a plain value (which becomes a Success). Success results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L68)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The recovered result or original success
##### rethrow
```php
public function rethrow(?Throwable $throwable = NULL): OpenFGA\Results\ResultInterface
```
Throws the contained error or continues the chain. For Failure results, this throws either the provided throwable or the contained error. For Success results, this method has no effect and returns the result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L77)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------- | ---------------------------------------------------------- |
| `$throwable` | `Throwable` | `null` | Optional throwable to throw instead of the contained error |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### succeeded
```php
public function succeeded(): bool
```
Determines if this result represents a success.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L86)
###### Returns
`bool` — True if this is a Success result, false if it's a Failure
##### success
```php
public function success(callable $fn): OpenFGA\Results\ResultInterface
```
Executes a callback when the result is a success and continues the chain. The callback receives the success value (specific response interface) as its parameter and is only executed for Success results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L95)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### then
```php
public function then(callable $fn): OpenFGA\Results\ResultInterface
```
Transforms a successful result using a callback and continues the chain. The callback is only executed for Success results and receives the specific response interface as its parameter. It can return either a new Result or a plain value (which becomes a Success). Failure results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L108)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The transformed result or original failure
##### unwrap
```php
public function unwrap(?callable $fn = NULL): mixed
```
Extracts the value from the result or applies a transformation. Without a callback, this returns the success value (specific response interface) or throws the failure error. With a callback, the function is called with either the response interface or failure error, and its return value is returned instead of throwing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Result.php#L22)
###### Parameters
| Name | Type | Description |
| ----- | ------------------------ | ----------- |
| `$fn` | `callable` | `null` | |
###### Returns
`mixed` — The response interface, callback result, or throws the error
##### val
```php
public function val(): mixed
```
Retrieves the value from a successful result. This method should only be called on Success results. Use succeeded() to check the result type before calling this method to avoid exceptions. Returns the specific response interface documented in the calling method's @return annotation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/Success.php#L124)
###### Returns
`mixed` — The response interface (for example CheckResponseInterface, StoreInterface)
<!-- End of evansims/openfga-php/docs/API/Results/Success.md -->
<!-- Source: evansims/openfga-php/docs/API/Results/SuccessInterface.md -->
### SuccessInterface
Represents a successful result containing a value. Success results indicate that an operation completed successfully and contain a value of the specified type. They provide type-safe access to successful outcomes while maintaining compatibility with the Result pattern's fluent interface. Success results behave predictably in all Result operations: - `succeeded()` always returns true - `failed()` always returns false - `val()` returns the contained value safely - `err()` throws since successes have no errors - `success()` executes callbacks with the value - `failure()` skips callbacks and returns unchanged - `then()` applies transformations to the value - `recover()` skips recovery and returns unchanged
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`err()`](#err)
- [`failed()`](#failed)
- [`failure()`](#failure)
- [`recover()`](#recover)
- [`rethrow()`](#rethrow)
- [`succeeded()`](#succeeded)
- [`success()`](#success)
- [`then()`](#then)
- [`unwrap()`](#unwrap)
- [`val()`](#val)
</details>
#### Namespace
`OpenFGA\Results`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Results/SuccessInterface.php)
#### Implements
- [`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md)
#### Related Classes
- [Success](https://github.com/evansims/openfga-php/blob/main/Results/Success.md) (implementation)
#### Methods
##### err
```php
public function err(): Throwable
```
Retrieves the error from a failed result. This method should only be called on Failure results. Use failed() to check the result type before calling this method to avoid exceptions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L71)
###### Returns
`Throwable` — The error that caused the failure
##### failed
```php
public function failed(): bool
```
Determines if this result represents a failure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L78)
###### Returns
`bool` — True if this is a Failure result, false if it's a Success
##### failure
```php
public function failure(callable $fn): ResultInterface
```
Executes a callback when the result is a failure and continues the chain. The callback receives the error as its parameter and is only executed for Failure results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### recover
```php
public function recover(callable $fn): ResultInterface
```
Recovers from a failure by transforming it into a success or different failure. The callback is only executed for Failure results and can return either a new Result or a plain value (which becomes a Success). Success results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L100)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The recovered result or original success
##### rethrow
```php
public function rethrow(Throwable|null $throwable = NULL): ResultInterface
```
Throws the contained error or continues the chain. For Failure results, this throws either the provided throwable or the contained error. For Success results, this method has no effect and returns the result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L114)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------- | ---------------------------------------------------------- |
| `$throwable` | `Throwable` | `null` | Optional throwable to throw instead of the contained error |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### succeeded
```php
public function succeeded(): bool
```
Determines if this result represents a success.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L121)
###### Returns
`bool` — True if this is a Success result, false if it's a Failure
##### success
```php
public function success(callable $fn): ResultInterface
```
Executes a callback when the result is a success and continues the chain. The callback receives the success value (specific response interface) as its parameter and is only executed for Success results. This method always returns the original result unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L132)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The original result for method chaining
##### then
```php
public function then(callable $fn): ResultInterface
```
Transforms a successful result using a callback and continues the chain. The callback is only executed for Success results and receives the specific response interface as its parameter. It can return either a new Result or a plain value (which becomes a Success). Failure results pass through unchanged.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L144)
###### Parameters
| Name | Type | Description |
| ----- | ---------- | ----------- |
| `$fn` | `callable` | |
###### Returns
[`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/ResultInterface.md) — The transformed result or original failure
##### unwrap
```php
public function unwrap(?callable $fn = NULL): mixed
```
Extracts the value from the result or applies a transformation. Without a callback, this returns the success value (specific response interface) or throws the failure error. With a callback, the function is called with either the response interface or failure error, and its return value is returned instead of throwing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L159)
###### Parameters
| Name | Type | Description |
| ----- | ------------------------ | ----------- |
| `$fn` | `callable` | `null` | |
###### Returns
`mixed` — The response interface, callback result, or throws the error
##### val
```php
public function val(): mixed
```
Retrieves the value from a successful result. This method should only be called on Success results. Use succeeded() to check the result type before calling this method to avoid exceptions. Returns the specific response interface documented in the calling method's @return annotation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Results/ResultInterface.php#L172)
###### Returns
`mixed` — The response interface (for example CheckResponseInterface, StoreInterface)
<!-- End of evansims/openfga-php/docs/API/Results/SuccessInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/CollectionSchema.md -->
### CollectionSchema
Schema definition specifically for validating and transforming collection data structures. This specialized schema handles arrays of objects, providing validation rules for collections while ensuring each item conforms to the specified item type. It supports wrapper keys for nested collection data and optional item requirements.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getClassName()`](#getclassname)
- [`getItemType()`](#getitemtype)
- [`getProperties()`](#getproperties)
- [`getProperty()`](#getproperty)
- [`getWrapperKey()`](#getwrapperkey)
- [`requiresItems()`](#requiresitems)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchema.php)
#### Implements
- [`CollectionSchemaInterface`](https://github.com/evansims/openfga-php/blob/main/CollectionSchemaInterface.md)
- [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md)
#### Related Classes
- [CollectionSchemaInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/CollectionSchemaInterface.md) (interface)
- [Schema](https://github.com/evansims/openfga-php/blob/main/Schemas/Schema.md) (item)
#### Methods
##### getClassName
```php
public function getClassName(): string
```
Get the fully qualified class name this schema defines. This method returns the class name that this schema describes, which is used during validation and object instantiation to ensure the correct model class is created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchema.php#L56)
###### Returns
`string` — The fully qualified class name for the model this schema defines
##### getItemType
```php
public function getItemType(): string
```
Get the type of each item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchema.php#L65)
###### Returns
`string`
##### getProperties
```php
public function getProperties(): array
```
Get all properties defined in this schema. This method returns a comprehensive collection of all properties that make up this schema, including their validation rules, types, and default values. Each property defines how a specific field should be validated and processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchema.php#L74)
###### Returns
`array` — An associative array of property names to their schema property definitions
##### getProperty
```php
public function getProperty(string $name): ?OpenFGA\Schemas\SchemaProperty
```
Get a specific property definition by name. This method retrieves the schema definition for a particular property, allowing you to access its validation rules, type information, and other metadata for individual fields.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchema.php#L84)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ------------------------------------ |
| `$name` | `string` | The name of the property to retrieve |
###### Returns
[`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/SchemaProperty.md) | `null` — The property definition if it exists, or null if the property is not defined in this schema
##### getWrapperKey
```php
public function getWrapperKey(): ?string
```
Get the wrapper key for the collection data if any. Some collections expect data wrapped in a specific key (for example, Usersets uses 'child').
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchema.php#L94)
###### Returns
`string` | `null` — The wrapper key or null if data is not wrapped
##### requiresItems
```php
public function requiresItems(): bool
```
Whether the collection requires at least one item.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchema.php#L103)
###### Returns
`bool` — True if the collection must contain at least one item, false if empty collections are allowed
<!-- End of evansims/openfga-php/docs/API/Schemas/CollectionSchema.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/CollectionSchemaInterface.md -->
### CollectionSchemaInterface
Interface for collection schema definitions in the OpenFGA system. This interface extends the base SchemaInterface to provide specialized validation and structure definitions for collections of objects. Collection schemas handle arrays and lists of objects that conform to specific types, with support for wrapper keys and item requirements. Collection schemas are essential for validating complex data structures like lists of users, authorization models, relationship tuples, and other grouped data returned by the OpenFGA API. Examples of collections include Users, AuthorizationModels, Tuples, and other array-based response data that require consistent validation and type safety.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getClassName()`](#getclassname)
- [`getItemType()`](#getitemtype)
- [`getProperties()`](#getproperties)
- [`getProperty()`](#getproperty)
- [`getWrapperKey()`](#getwrapperkey)
- [`requiresItems()`](#requiresitems)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchemaInterface.php)
#### Implements
- [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md)
#### Related Classes
- [SchemaInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaInterface.md) (item)
- [CollectionSchema](https://github.com/evansims/openfga-php/blob/main/Schemas/CollectionSchema.md) (implementation)
#### Methods
##### getClassName
```php
public function getClassName(): string
```
Get the fully qualified class name this schema defines. This method returns the class name that this schema describes, which is used during validation and object instantiation to ensure the correct model class is created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaInterface.php#L38)
###### Returns
`string` — The fully qualified class name for the model this schema defines
##### getItemType
```php
public function getItemType(): string
```
Get the type of each item in the collection.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchemaInterface.php#L38)
###### Returns
`string`
##### getProperties
```php
public function getProperties(): array<string, SchemaProperty>
```
Get all properties defined in this schema. This method returns a comprehensive collection of all properties that make up this schema, including their validation rules, types, and default values. Each property defines how a specific field should be validated and processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaInterface.php#L49)
###### Returns
`array<`string`, [`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/SchemaProperty.md)>` — An associative array of property names to their schema property definitions
##### getProperty
```php
public function getProperty(string $name): SchemaProperty|null
```
Get a specific property definition by name. This method retrieves the schema definition for a particular property, allowing you to access its validation rules, type information, and other metadata for individual fields.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaInterface.php#L60)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ------------------------------------ |
| `$name` | `string` | The name of the property to retrieve |
###### Returns
[`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/SchemaProperty.md) | `null` — The property definition if it exists, or null if the property is not defined in this schema
##### getWrapperKey
```php
public function getWrapperKey(): string|null
```
Get the wrapper key for the collection data if any. Some collections expect data wrapped in a specific key (for example, Usersets uses 'child').
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchemaInterface.php#L47)
###### Returns
`string` | `null` — The wrapper key or null if data is not wrapped
##### requiresItems
```php
public function requiresItems(): bool
```
Whether the collection requires at least one item.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/CollectionSchemaInterface.php#L54)
###### Returns
`bool` — True if the collection must contain at least one item, false if empty collections are allowed
<!-- End of evansims/openfga-php/docs/API/Schemas/CollectionSchemaInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/README.md -->
## Schemas
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Schemas
JSON schema validation for ensuring data integrity and type safety.
**Total Components:** 14
### Interfaces
| Name | Description |
|------|-------------|
| [`CollectionSchemaInterface`](https://github.com/evansims/openfga-php/blob/main/./CollectionSchemaInterface.md) | Interface for collection schema definitions in the OpenFGA system. This interface extends the bas... |
| [`SchemaBuilderInterface`](https://github.com/evansims/openfga-php/blob/main/./SchemaBuilderInterface.md) | Interface for building schema definitions using the builder pattern. This interface provides a fl... |
| [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/./SchemaInterface.md) | Base interface for schema definitions in the OpenFGA system. This interface defines the fundament... |
| [`SchemaPropertyInterface`](https://github.com/evansims/openfga-php/blob/main/./SchemaPropertyInterface.md) | Interface for schema property definitions. This interface defines the contract for schema propert... |
| [`SchemaRegistryInterface`](https://github.com/evansims/openfga-php/blob/main/./SchemaRegistryInterface.md) | Registry for managing schema definitions in the OpenFGA system. This interface provides a central... |
| [`SchemaValidatorInterface`](https://github.com/evansims/openfga-php/blob/main/./SchemaValidatorInterface.md) | Interface for schema validation and object transformation in the OpenFGA system. This interface d... |
| [`ValidationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./ValidationServiceInterface.md) | Service for validating data against schemas. This service encapsulates the validation logic, sepa... |
### Classes
| Name | Description |
|------|-------------|
| [`CollectionSchema`](https://github.com/evansims/openfga-php/blob/main/./CollectionSchema.md) | Schema definition specifically for validating and transforming collection data structures. This s... |
| [`Schema`](https://github.com/evansims/openfga-php/blob/main/./Schema.md) | JSON schema definition for validating and transforming data structures. This schema defines valid... |
| [`SchemaBuilder`](https://github.com/evansims/openfga-php/blob/main/./SchemaBuilder.md) | Fluent builder for creating JSON schemas for data validation and transformation. This builder pro... |
| [`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/./SchemaProperty.md) | Represents a single property definition within a schema. This class defines the validation rules,... |
| [`SchemaRegistry`](https://github.com/evansims/openfga-php/blob/main/./SchemaRegistry.md) | Centralized registry for managing schema definitions across the OpenFGA system. This registry pro... |
| [`SchemaValidator`](https://github.com/evansims/openfga-php/blob/main/./SchemaValidator.md) | Validates and transforms data according to registered JSON schemas. This validator ensures that A... |
| [`ValidationService`](https://github.com/evansims/openfga-php/blob/main/./ValidationService.md) | Service for validating data against schemas. This service encapsulates validation logic, separati... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Schemas/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/Schema.md -->
### Schema
JSON schema definition for validating and transforming data structures. This schema defines validation rules and transformation logic for converting raw API response data into strongly typed model objects. It specifies property types, validation constraints, and mapping rules for accurate data processing.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getClassName()`](#getclassname)
- [`getProperties()`](#getproperties)
- [`getProperty()`](#getproperty)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/Schema.php)
#### Implements
- [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md)
#### Related Classes
- [SchemaInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaInterface.md) (interface)
#### Methods
##### getClassName
```php
public function getClassName(): string
```
Get the fully qualified class name this schema defines. This method returns the class name that this schema describes, which is used during validation and object instantiation to ensure the correct model class is created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/Schema.php#L44)
###### Returns
`string` — The fully qualified class name for the model this schema defines
##### getProperties
```php
public function getProperties(): array
```
Get all properties defined in this schema. This method returns a comprehensive collection of all properties that make up this schema, including their validation rules, types, and default values. Each property defines how a specific field should be validated and processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/Schema.php#L53)
###### Returns
`array` — An associative array of property names to their schema property definitions
##### getProperty
```php
public function getProperty(string $name): ?OpenFGA\Schemas\SchemaProperty
```
Get a specific property definition by name. This method retrieves the schema definition for a particular property, allowing you to access its validation rules, type information, and other metadata for individual fields.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/Schema.php#L62)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ------------------------------------ |
| `$name` | `string` | The name of the property to retrieve |
###### Returns
[`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/SchemaProperty.md) | `null` — The property definition if it exists, or null if the property is not defined in this schema
<!-- End of evansims/openfga-php/docs/API/Schemas/Schema.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaBuilder.md -->
### SchemaBuilder
Fluent builder for creating JSON schemas for data validation and transformation. This builder provides a fluent API for defining validation schemas for model classes, supporting various data types, formats, and validation constraints. It's used internally by the SDK to validate API responses and ensure data integrity.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`array()`](#array)
- [`boolean()`](#boolean)
- [`date()`](#date)
- [`datetime()`](#datetime)
- [`integer()`](#integer)
- [`number()`](#number)
- [`object()`](#object)
- [`register()`](#register)
- [`string()`](#string)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php)
#### Implements
- [`SchemaBuilderInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaBuilderInterface.md)
#### Related Classes
- [SchemaBuilderInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaBuilderInterface.md) (interface)
#### Methods
##### array
```php
public function array(
string $name,
array $items,
bool $required = false,
mixed $default = NULL,
): self
```
Add an array property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L39)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$items` | `array` | |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### boolean
```php
public function boolean(string $name, bool $required = false, mixed $default = NULL): self
```
Add a boolean property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L56)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### date
```php
public function date(string $name, bool $required = false, mixed $default = NULL): self
```
Add a date property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L72)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### datetime
```php
public function datetime(string $name, bool $required = false, mixed $default = NULL): self
```
Add a datetime property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L89)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### integer
```php
public function integer(string $name, bool $required = false, mixed $default = NULL): self
```
Add an integer property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L106)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### number
```php
public function number(string $name, bool $required = false, mixed $default = NULL): self
```
Add a number (float) property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L122)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### object
```php
public function object(string $name, string $className, bool $required = false): self
```
Add an object property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L138)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | -------------------------------------- |
| `$name` | `string` | The property name |
| `$className` | `string` | The class name for the object property |
| `$required` | `bool` | Whether the property is required |
###### Returns
`self` — Returns the builder instance for method chaining
##### register
```php
public function register(): OpenFGA\Schemas\Schema
```
Build and register the schema. Creates a Schema instance with all defined properties and registers it in the SchemaRegistry for use in validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L154)
###### Returns
[`Schema`](https://github.com/evansims/openfga-php/blob/main/Schema.md) — The built and registered schema
##### string
```php
public function string(
string $name,
bool $required = false,
?string $format = NULL,
?array $enum = NULL,
mixed $default = NULL,
): self
```
Add a string property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilder.php#L166)
###### Parameters
| Name | Type | Description |
| ----------- | ---------------------- | ----------------------------------------------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$format` | `string` | `null` | String format constraint (for example 'date', 'datetime') |
| `$enum` | `array` | `null` | Array of allowed string values |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaBuilder.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaBuilderInterface.md -->
### SchemaBuilderInterface
Interface for building schema definitions using the builder pattern. This interface provides a fluent API for constructing schema definitions that describe the structure and validation rules for OpenFGA model objects. The builder pattern allows for easy, readable schema creation with method chaining. Schema builders support all common data types including strings, integers, booleans, dates, arrays, and complex objects. Each property can be configured with validation rules such as required status, default values, format constraints, and enumeration restrictions. Example usage: ```php $schema = $builder ->string('name', required: true) ->integer('age', required: false, default: 0) ->object('address', Address::class, required: true) ->register(); ``` The built schemas are automatically registered in the SchemaRegistry for use during validation and object transformation throughout the OpenFGA system.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`array()`](#array)
- [`boolean()`](#boolean)
- [`date()`](#date)
- [`datetime()`](#datetime)
- [`integer()`](#integer)
- [`number()`](#number)
- [`object()`](#object)
- [`register()`](#register)
- [`string()`](#string)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php)
#### Related Classes
- [SchemaBuilder](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaBuilder.md) (implementation)
#### Methods
##### array
```php
public function array(
string $name,
array $items,
bool $required = false,
mixed $default = NULL,
): self
```
Add an array property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L46)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$items` | `array` | |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### boolean
```php
public function boolean(string $name, bool $required = false, mixed|null $default = NULL): self
```
Add a boolean property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L56)
###### Parameters
| Name | Type | Description |
| ----------- | --------------------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | `null` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### date
```php
public function date(string $name, bool $required = false, mixed|null $default = NULL): self
```
Add a date property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L66)
###### Parameters
| Name | Type | Description |
| ----------- | --------------------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | `null` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### datetime
```php
public function datetime(string $name, bool $required = false, mixed|null $default = NULL): self
```
Add a datetime property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L76)
###### Parameters
| Name | Type | Description |
| ----------- | --------------------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | `null` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### integer
```php
public function integer(string $name, bool $required = false, mixed|null $default = NULL): self
```
Add an integer property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L86)
###### Parameters
| Name | Type | Description |
| ----------- | --------------------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | `null` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### number
```php
public function number(string $name, bool $required = false, mixed|null $default = NULL): self
```
Add a number (float) property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L96)
###### Parameters
| Name | Type | Description |
| ----------- | --------------------- | ------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$default` | `mixed` | `null` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
##### object
```php
public function object(string $name, string $className, bool $required = false): self
```
Add an object property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L106)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | -------------------------------------- |
| `$name` | `string` | The property name |
| `$className` | `string` | The class name for the object property |
| `$required` | `bool` | Whether the property is required |
###### Returns
`self` — Returns the builder instance for method chaining
##### register
```php
public function register(): Schema
```
Build and register the schema. Creates a Schema instance with all defined properties and registers it in the SchemaRegistry for use in validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L116)
###### Returns
[`Schema`](https://github.com/evansims/openfga-php/blob/main/Schema.md) — The built and registered schema
##### string
```php
public function string(
string $name,
bool $required = false,
string|null $format = NULL,
array<string>|null $enum = NULL,
mixed $default = NULL,
): self
```
Add a string property to the schema.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaBuilderInterface.php#L128)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------- | ----------------------------------------------------------------------------- |
| `$name` | `string` | The property name |
| `$required` | `bool` | Whether the property is required |
| `$format` | `string` | `null` | String format constraint (for example 'date', 'datetime') |
| `$enum` | `array<`string`>` | `null` | Array of allowed string values |
| `$default` | `mixed` | Default value for optional properties |
###### Returns
`self` — Returns the builder instance for method chaining
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaBuilderInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaInterface.md -->
### SchemaInterface
Base interface for schema definitions in the OpenFGA system. This interface defines the fundamental contract for all schema objects that describe the structure and validation rules for OpenFGA model classes. Schemas serve as the blueprint for validating raw data (typically from JSON API responses) and transforming it into properly typed PHP objects. Schemas encapsulate the validation rules, type information, and metadata needed to ensure data integrity and type safety throughout the OpenFGA SDK. They define which properties are required, their data types, format constraints, default values, and relationships to other objects. This base interface is extended by specialized schema types such as CollectionSchemaInterface for handling arrays and lists of objects with consistent validation behavior.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getClassName()`](#getclassname)
- [`getProperties()`](#getproperties)
- [`getProperty()`](#getproperty)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaInterface.php)
#### Related Classes
- [Schema](https://github.com/evansims/openfga-php/blob/main/Schemas/Schema.md) (implementation)
#### Methods
##### getClassName
```php
public function getClassName(): string
```
Get the fully qualified class name this schema defines. This method returns the class name that this schema describes, which is used during validation and object instantiation to ensure the correct model class is created.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaInterface.php#L38)
###### Returns
`string` — The fully qualified class name for the model this schema defines
##### getProperties
```php
public function getProperties(): array<string, SchemaProperty>
```
Get all properties defined in this schema. This method returns a comprehensive collection of all properties that make up this schema, including their validation rules, types, and default values. Each property defines how a specific field should be validated and processed.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaInterface.php#L49)
###### Returns
`array<`string`, [`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/SchemaProperty.md)>` — An associative array of property names to their schema property definitions
##### getProperty
```php
public function getProperty(string $name): SchemaProperty|null
```
Get a specific property definition by name. This method retrieves the schema definition for a particular property, allowing you to access its validation rules, type information, and other metadata for individual fields.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaInterface.php#L60)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ------------------------------------ |
| `$name` | `string` | The name of the property to retrieve |
###### Returns
[`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/SchemaProperty.md) | `null` — The property definition if it exists, or null if the property is not defined in this schema
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaProperty.md -->
### SchemaProperty
Represents a single property definition within a schema. This class defines the validation rules, type information, and metadata for individual properties of OpenFGA model objects. Each property specifies how a field should be validated, transformed, and mapped during object creation. Properties support various data types including primitives (string, int, bool), complex objects, arrays, and collections, with optional validation constraints such as required status, default values, format restrictions, and enumeration limits.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getClassName()`](#getclassname)
- [`getDefault()`](#getdefault)
- [`getEnum()`](#getenum)
- [`getFormat()`](#getformat)
- [`getItems()`](#getitems)
- [`getName()`](#getname)
- [`getParameterName()`](#getparametername)
- [`getType()`](#gettype)
- [`isRequired()`](#isrequired)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php)
#### Implements
- [`SchemaPropertyInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaPropertyInterface.md)
#### Related Classes
- [SchemaPropertyInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaPropertyInterface.md) (interface)
#### Methods
##### getClassName
```php
public function getClassName(): ?string
```
Get the fully qualified class name for object types.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L53)
###### Returns
`string` | `null`
##### getDefault
```php
public function getDefault(): mixed
```
Get the default value to use when property is missing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L62)
###### Returns
`mixed` — Default value for optional properties
##### getEnum
```php
public function getEnum(): ?array
```
Get the array of allowed values for enumeration validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L71)
###### Returns
`array` | `null` — Array of allowed values or null if not an enumeration
##### getFormat
```php
public function getFormat(): ?string
```
Get the additional format constraint for this property.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L80)
###### Returns
`string` | `null` — Format constraint (for example 'date', 'datetime') or null if none
##### getItems
```php
public function getItems(): ?array
```
Get the type specification for array items.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L89)
###### Returns
`array` | `null`
##### getName
```php
public function getName(): string
```
Get the property name as it appears in the data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L98)
###### Returns
`string` — The property name
##### getParameterName
```php
public function getParameterName(): ?string
```
Get the alternative parameter name for constructor mapping.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L107)
###### Returns
`string` | `null` — Alternative parameter name or null if using default mapping
##### getType
```php
public function getType(): string
```
Get the data type for this property.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L116)
###### Returns
`string` — The data type (string, integer, boolean, array, object, etc.)
##### isRequired
```php
public function isRequired(): bool
```
Check if this property is required for validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaProperty.php#L125)
###### Returns
`bool` — True if the property is required, false otherwise
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaProperty.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaPropertyInterface.md -->
### SchemaPropertyInterface
Interface for schema property definitions. This interface defines the contract for schema property objects that specify validation rules, type information, and metadata for individual properties of OpenFGA model objects. Each property defines how a field should be validated, transformed, and mapped during object creation. Properties support various data types including primitives (string, int, bool), complex objects, arrays, and collections, with optional validation constraints such as required status, default values, format restrictions, and enumeration limits.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getClassName()`](#getclassname)
- [`getDefault()`](#getdefault)
- [`getEnum()`](#getenum)
- [`getFormat()`](#getformat)
- [`getItems()`](#getitems)
- [`getName()`](#getname)
- [`getParameterName()`](#getparametername)
- [`getType()`](#gettype)
- [`isRequired()`](#isrequired)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php)
#### Related Classes
- [SchemaProperty](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaProperty.md) (implementation)
#### Methods
##### getClassName
```php
public function getClassName(): ?string
```
Get the fully qualified class name for object types.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L29)
###### Returns
`string` | `null`
##### getDefault
```php
public function getDefault(): mixed
```
Get the default value to use when property is missing.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L36)
###### Returns
`mixed` — Default value for optional properties
##### getEnum
```php
public function getEnum(): array<string>|null
```
Get the array of allowed values for enumeration validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L43)
###### Returns
`array<`string`>` | `null` — Array of allowed values or null if not an enumeration
##### getFormat
```php
public function getFormat(): string|null
```
Get the additional format constraint for this property.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L50)
###### Returns
`string` | `null` — Format constraint (for example 'date', 'datetime') or null if none
##### getItems
```php
public function getItems(): ?array
```
Get the type specification for array items.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L57)
###### Returns
`array` | `null`
##### getName
```php
public function getName(): string
```
Get the property name as it appears in the data.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L64)
###### Returns
`string` — The property name
##### getParameterName
```php
public function getParameterName(): string|null
```
Get the alternative parameter name for constructor mapping.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L71)
###### Returns
`string` | `null` — Alternative parameter name or null if using default mapping
##### getType
```php
public function getType(): string
```
Get the data type for this property.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L78)
###### Returns
`string` — The data type (string, integer, boolean, array, object, etc.)
##### isRequired
```php
public function isRequired(): bool
```
Check if this property is required for validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaPropertyInterface.php#L85)
###### Returns
`bool` — True if the property is required, false otherwise
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaPropertyInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaRegistry.md -->
### SchemaRegistry
Centralized registry for managing schema definitions across the OpenFGA system. This registry provides a static, global repository for schema definitions that can be accessed throughout the application lifecycle. It serves as the primary mechanism for storing, retrieving, and creating schema definitions for OpenFGA model objects. The registry supports both programmatic schema creation through the builder pattern and direct schema registration for pre-defined schemas. This centralized approach ensures consistent schema validation across all model objects and eliminates the need for redundant schema definitions. Schemas registered here are used by the SchemaValidator for object validation and transformation during API response processing and data serialization operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`create()`](#create)
- [`get()`](#get)
- [`register()`](#register)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaRegistry.php)
#### Implements
- [`SchemaRegistryInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaRegistryInterface.md)
#### Related Classes
- [SchemaRegistryInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaRegistryInterface.md) (interface)
#### Methods
##### create
*<small>Implements Schemas\SchemaRegistryInterface</small>*
```php
public function create(string $className): SchemaBuilder
```
Create a new schema builder for the specified class.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaRegistryInterface.php#L29)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ------------------------------ |
| `$className` | `string` | The fully qualified class name |
###### Returns
[`SchemaBuilder`](https://github.com/evansims/openfga-php/blob/main/SchemaBuilder.md) — A new schema builder instance
##### get
*<small>Implements Schemas\SchemaRegistryInterface</small>*
```php
public function get(string $className): ?OpenFGA\Schemas\Schema
```
Retrieve a registered schema by class name.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaRegistryInterface.php#L37)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ------------------------------ |
| `$className` | `string` | The fully qualified class name |
###### Returns
[`Schema`](https://github.com/evansims/openfga-php/blob/main/Schema.md) | `null`
##### register
*<small>Implements Schemas\SchemaRegistryInterface</small>*
```php
public function register(Schema $schema): void
```
Register a schema in the registry.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaRegistryInterface.php#L44)
###### Parameters
| Name | Type | Description |
| --------- | --------------------- | ------------------------------- |
| `$schema` | [`Schema`](https://github.com/evansims/openfga-php/blob/main/Schema.md) | The schema instance to register |
###### Returns
`void`
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaRegistry.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaRegistryInterface.md -->
### SchemaRegistryInterface
Registry for managing schema definitions in the OpenFGA system. This interface provides a centralized storage and retrieval system for schema objects, enabling registration and lookup of schemas by class name. The registry serves as the single source of truth for all schema definitions used throughout the OpenFGA SDK. The registry supports dynamic schema registration during runtime and provides factory methods for creating new schema builders. This centralized approach ensures consistent validation behavior across all OpenFGA model objects and API responses.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaRegistryInterface.php)
#### Related Classes
- [SchemaRegistry](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaRegistry.md) (implementation)
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaRegistryInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaValidator.md -->
### SchemaValidator
Validates and transforms data according to registered JSON schemas. This validator ensures that API response data conforms to expected schemas and transforms raw arrays into strongly typed model objects. It handles nested objects, collections, and complex validation rules while providing detailed error reporting for schema violations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getSchemas()`](#getschemas)
- [`registerSchema()`](#registerschema)
- [`validateAndTransform()`](#validateandtransform)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidator.php)
#### Implements
- [`SchemaValidatorInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaValidatorInterface.md)
#### Related Classes
- [SchemaValidatorInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaValidatorInterface.md) (interface)
#### Methods
##### getSchemas
```php
public function getSchemas(): array
```
Get all currently registered schemas. Returns a comprehensive map of all schemas that have been registered with this validator, keyed by their associated class names. This is useful for debugging, introspection, and understanding which schemas are available for validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidator.php#L72)
###### Returns
`array` — Map of class names to their schema definitions
##### registerSchema
```php
public function registerSchema(OpenFGA\Schemas\SchemaInterface $schema): self
```
Register a schema for validation use. Adds a schema to the validator's registry, making it available for use in validation and transformation operations. Schemas must be registered before they can be used to validate data for their associated class.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidator.php#L81)
###### Parameters
| Name | Type | Description |
| --------- | --------------------------------------- | --------------------------------- |
| `$schema` | [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md) | The schema definition to register |
###### Returns
`self` — Returns the validator instance for method chaining
##### validateAndTransform
```php
public function validateAndTransform(mixed $data, string $className): object
```
Validate data against a registered schema and transform it into the target class instance. This method performs comprehensive validation of the provided data against the schema for the specified class name. If validation succeeds, it creates and returns a fully initialized instance of the target class with all data properly transformed and typed. The validation process includes: - Required field validation - Type checking and conversion - Format validation (dates, enums, etc.) - Nested object validation - Collection validation for arrays - Constructor parameter mapping - Default value application
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidator.php#L96)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ------------------------------------------------------- |
| `$data` | `mixed` | The raw data to validate (typically an array from JSON) |
| `$className` | `string` | The fully qualified class name to validate against |
###### Returns
`object` — The validated and transformed object instance
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaValidator.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/SchemaValidatorInterface.md -->
### SchemaValidatorInterface
Interface for schema validation and object transformation in the OpenFGA system. This interface defines the contract for validating raw data (typically from JSON API responses) against registered schemas and transforming that data into properly typed OpenFGA model objects. The validator ensures data integrity and type safety throughout the SDK. Schema validators maintain a registry of schemas and provide validation services for both individual objects and collections. They handle complex validation scenarios including nested objects, arrays, conditional properties, and custom format constraints. The transformation process creates fully initialized model objects with proper type casting, default value handling, and constructor parameter mapping based on the schema definitions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getSchemas()`](#getschemas)
- [`registerSchema()`](#registerschema)
- [`validateAndTransform()`](#validateandtransform)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidatorInterface.php)
#### Related Classes
- [SchemaValidator](https://github.com/evansims/openfga-php/blob/main/Schemas/SchemaValidator.md) (implementation)
#### Methods
##### getSchemas
```php
public function getSchemas(): array<string, SchemaInterface>
```
Get all currently registered schemas. Returns a comprehensive map of all schemas that have been registered with this validator, keyed by their associated class names. This is useful for debugging, introspection, and understanding which schemas are available for validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidatorInterface.php#L39)
###### Returns
`array<`string`, [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md)>` — Map of class names to their schema definitions
##### registerSchema
```php
public function registerSchema(SchemaInterface $schema): self
```
Register a schema for validation use. Adds a schema to the validator's registry, making it available for use in validation and transformation operations. Schemas must be registered before they can be used to validate data for their associated class.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidatorInterface.php#L51)
###### Parameters
| Name | Type | Description |
| --------- | --------------------------------------- | --------------------------------- |
| `$schema` | [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md) | The schema definition to register |
###### Returns
`self` — Returns the validator instance for method chaining
##### validateAndTransform
```php
public function validateAndTransform(mixed $data, string $className): T
```
Validate data against a registered schema and transform it into the target class instance. This method performs comprehensive validation of the provided data against the schema for the specified class name. If validation succeeds, it creates and returns a fully initialized instance of the target class with all data properly transformed and typed. The validation process includes: - Required field validation - Type checking and conversion - Format validation (dates, enums, etc.) - Nested object validation - Collection validation for arrays - Constructor parameter mapping - Default value application
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/SchemaValidatorInterface.php#L78)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ------------------------------------------------------- |
| `$data` | `mixed` | The raw data to validate (typically an array from JSON) |
| `$className` | `string` | The fully qualified class name to validate against |
###### Returns
`T` — The validated and transformed object instance
<!-- End of evansims/openfga-php/docs/API/Schemas/SchemaValidatorInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/ValidationService.md -->
### ValidationService
Service for validating data against schemas. This service encapsulates validation logic, separating it from object construction concerns in SchemaValidator. It provides validation for both complete data structures and individual properties, with detailed error reporting.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`hasSchema()`](#hasschema)
- [`registerSchema()`](#registerschema)
- [`validate()`](#validate)
- [`validateProperty()`](#validateproperty)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationService.php)
#### Implements
- [`ValidationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/ValidationServiceInterface.md)
#### Related Classes
- [ValidationServiceInterface](https://github.com/evansims/openfga-php/blob/main/Schemas/ValidationServiceInterface.md) (interface)
#### Methods
##### hasSchema
```php
public function hasSchema(string $className): bool
```
Check if a schema is registered for a class.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationService.php#L41)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------- |
| `$className` | `string` | The class name to check |
###### Returns
`bool` — True if schema is registered
##### registerSchema
```php
public function registerSchema(OpenFGA\Schemas\SchemaInterface $schema): self
```
Register a schema for validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationService.php#L50)
###### Parameters
| Name | Type | Description |
| --------- | --------------------------------------- | ---------------------- |
| `$schema` | [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md) | The schema to register |
###### Returns
`self` — For method chaining
##### validate
```php
public function validate(mixed $data, string $className): array<string, mixed>
```
Validate data against a schema. Validates the provided data against the schema for the specified class. This method only validates structure and types, it does not construct objects.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationService.php#L66)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------------------------------- |
| `$data` | `mixed` | The data to validate |
| `$className` | `string` | The class name whose schema to validate against |
###### Returns
`array<`string`, `mixed`>` — The validated data (may be normalized/cleaned)
##### validateProperty
```php
public function validateProperty(mixed $value, OpenFGA\Schemas\SchemaPropertyInterface $property, string $path): mixed
```
Validate a property value against its schema definition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationService.php#L134)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------- | ------------------------------------- |
| `$value` | `mixed` | The value to validate |
| `$property` | [`SchemaPropertyInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaPropertyInterface.md) | The property schema |
| `$path` | `string` | The property path for error reporting |
###### Returns
`mixed` — The validated value
<!-- End of evansims/openfga-php/docs/API/Schemas/ValidationService.md -->
<!-- Source: evansims/openfga-php/docs/API/Schemas/ValidationServiceInterface.md -->
### ValidationServiceInterface
Service for validating data against schemas. This service encapsulates the validation logic, separating it from object construction concerns. It validates data structures against registered schemas and provides detailed error reporting.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`hasSchema()`](#hasschema)
- [`registerSchema()`](#registerschema)
- [`validate()`](#validate)
- [`validateProperty()`](#validateproperty)
</details>
#### Namespace
`OpenFGA\Schemas`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationServiceInterface.php)
#### Related Classes
- [ValidationService](https://github.com/evansims/openfga-php/blob/main/Schemas/ValidationService.md) (implementation)
#### Methods
##### hasSchema
```php
public function hasSchema(string $className): bool
```
Check if a schema is registered for a class.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationServiceInterface.php#L24)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------- |
| `$className` | `string` | The class name to check |
###### Returns
`bool` — True if schema is registered
##### registerSchema
```php
public function registerSchema(SchemaInterface $schema): self
```
Register a schema for validation.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationServiceInterface.php#L32)
###### Parameters
| Name | Type | Description |
| --------- | --------------------------------------- | ---------------------- |
| `$schema` | [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaInterface.md) | The schema to register |
###### Returns
`self` — For method chaining
##### validate
```php
public function validate(mixed $data, string $className): array<string, mixed>
```
Validate data against a schema. Validates the provided data against the schema for the specified class. This method only validates structure and types, it does not construct objects.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationServiceInterface.php#L47)
###### Parameters
| Name | Type | Description |
| ------------ | -------- | ----------------------------------------------- |
| `$data` | `mixed` | The data to validate |
| `$className` | `string` | The class name whose schema to validate against |
###### Returns
`array<`string`, `mixed`>` — The validated data (may be normalized/cleaned)
##### validateProperty
```php
public function validateProperty(mixed $value, SchemaPropertyInterface $property, string $path): mixed
```
Validate a property value against its schema definition.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Schemas/ValidationServiceInterface.php#L60)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------- | ------------------------------------- |
| `$value` | `mixed` | The value to validate |
| `$property` | [`SchemaPropertyInterface`](https://github.com/evansims/openfga-php/blob/main/SchemaPropertyInterface.md) | The property schema |
| `$path` | `string` | The property path for error reporting |
###### Returns
`mixed` — The validated value
<!-- End of evansims/openfga-php/docs/API/Schemas/ValidationServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/AssertionService.md -->
### AssertionService
Service implementation for managing OpenFGA authorization model assertions. Provides business-focused operations for working with assertions, which are test cases that validate the behavior of authorization models. This service abstracts the underlying repository implementation and adds value through validation, convenience methods, and enhanced error handling.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`clearAssertions()`](#clearassertions)
- [`executeAssertions()`](#executeassertions)
- [`getAssertionStatistics()`](#getassertionstatistics)
- [`readAssertions()`](#readassertions)
- [`validateAssertions()`](#validateassertions)
- [`writeAssertions()`](#writeassertions)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionService.php)
#### Implements
- [`AssertionServiceInterface`](https://github.com/evansims/openfga-php/blob/main/AssertionServiceInterface.md)
#### Related Classes
- [AssertionServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/AssertionServiceInterface.md) (interface)
#### Methods
##### clearAssertions
```php
public function clearAssertions(
string $authorizationModelId,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Clear all assertions from an authorization model. Removes all test assertions from the specified authorization model. This is useful when completely restructuring test cases or during development iterations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionService.php#L49)
###### Parameters
| Name | Type | Description |
| ----------------------- | -------- | -------------------------------- |
| `$authorizationModelId` | `string` | The authorization model to clear |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if cleared, or Failure with error details
##### executeAssertions
```php
public function executeAssertions(
string $authorizationModelId,
OpenFGA\Models\Collections\AssertionsInterface $assertions,
): OpenFGA\Results\Failure|OpenFGA\Results\Success|OpenFGA\Results\SuccessInterface
```
Execute assertions against the authorization model. Runs the specified assertions and returns the results, comparing expected outcomes with actual authorization check results. This helps verify that your authorization model works correctly.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionService.php#L64)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------- |
| `$authorizationModelId` | `string` | The authorization model to test |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to execute |
###### Returns
[`Failure`](https://github.com/evansims/openfga-php/blob/main/Results/Failure.md) | [`Success`](https://github.com/evansims/openfga-php/blob/main/Results/Success.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with test results, or Failure with execution errors
##### getAssertionStatistics
```php
public function getAssertionStatistics(
OpenFGA\Models\StoreInterface|string $store,
string $authorizationModelId,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Get assertion execution statistics. Provides insights into assertion test results, including pass/fail counts, execution times, and common failure patterns. Useful for monitoring authorization model health and test coverage.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionService.php#L114)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------ | ---------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to analyze |
| `$authorizationModelId` | `string` | The authorization model to analyze |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with statistics, or Failure with error details
##### readAssertions
```php
public function readAssertions(
string $authorizationModelId,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Read assertions from an authorization model. Retrieves all test assertions defined in the specified authorization model. Assertions validate that the model behaves correctly for specific scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionService.php#L152)
###### Parameters
| Name | Type | Description |
| ----------------------- | -------- | ------------------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID containing assertions |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with assertions collection, or Failure with error details
##### validateAssertions
```php
public function validateAssertions(
OpenFGA\Models\Collections\AssertionsInterface $assertions,
string $authorizationModelId,
): OpenFGA\Results\Failure|OpenFGA\Results\Success|OpenFGA\Results\SuccessInterface
```
Validate assertion syntax and logic. Checks that assertions are properly formatted and reference valid types and relations from the authorization model. This helps catch errors before deploying assertions to production.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionService.php#L167)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------------------- |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to validate |
| `$authorizationModelId` | `string` | The authorization model to validate against |
###### Returns
[`Failure`](https://github.com/evansims/openfga-php/blob/main/Results/Failure.md) | [`Success`](https://github.com/evansims/openfga-php/blob/main/Results/Success.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if valid, or Failure with validation errors
##### writeAssertions
```php
public function writeAssertions(
string $authorizationModelId,
OpenFGA\Models\Collections\AssertionsInterface $assertions,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Write assertions to an authorization model. Updates the test assertions for the specified authorization model. Assertions help validate that your authorization model works as expected by defining specific test cases and their expected outcomes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionService.php#L202)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID to update |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to write |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if written, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/AssertionService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/AssertionServiceInterface.md -->
### AssertionServiceInterface
Service interface for managing OpenFGA authorization model assertions. This service provides business-focused operations for working with assertions, which are test cases that validate the behavior of authorization models. Assertions help ensure that your authorization model works as expected by defining specific scenarios and their expected outcomes. ## Core Operations The service supports assertion management with enhanced functionality: - Read existing assertions from authorization models - Write new assertions to validate model behavior - Validate assertion syntax and logic - Batch operations for managing multiple assertions ## Assertion Validation Assertions define test cases like: - "user:anne should have reader access to document:budget-2024" - "user:bob should NOT have admin access to folder:public" - "group:finance#member should have write access to report:quarterly" ## Usage Example ```php $assertionService = new AssertionService($assertionRepository); Read existing assertions $assertions = $assertionService->readAssertions( $store, $authorizationModel )->unwrap(); Write new assertions $newAssertions = new Assertions([ new Assertion( new TupleKey('user:anne', 'reader', 'document:budget'), true // expected result ) ]); $result = $assertionService->writeAssertions( $store, $authorizationModel, $newAssertions )->unwrap(); ```
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`clearAssertions()`](#clearassertions)
- [`executeAssertions()`](#executeassertions)
- [`getAssertionStatistics()`](#getassertionstatistics)
- [`readAssertions()`](#readassertions)
- [`validateAssertions()`](#validateassertions)
- [`writeAssertions()`](#writeassertions)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionServiceInterface.php)
#### Related Classes
- [AssertionService](https://github.com/evansims/openfga-php/blob/main/Services/AssertionService.md) (implementation)
#### Methods
##### clearAssertions
```php
public function clearAssertions(string $authorizationModelId): FailureInterface|SuccessInterface
```
Clear all assertions from an authorization model. Removes all test assertions from the specified authorization model. This is useful when completely restructuring test cases or during development iterations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionServiceInterface.php#L75)
###### Parameters
| Name | Type | Description |
| ----------------------- | -------- | -------------------------------- |
| `$authorizationModelId` | `string` | The authorization model to clear |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if cleared, or Failure with error details
##### executeAssertions
```php
public function executeAssertions(
string $authorizationModelId,
AssertionsInterface $assertions,
): FailureInterface|SuccessInterface
```
Execute assertions against the authorization model. Runs the specified assertions and returns the results, comparing expected outcomes with actual authorization check results. This helps verify that your authorization model works correctly.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionServiceInterface.php#L90)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------- |
| `$authorizationModelId` | `string` | The authorization model to test |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to execute |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with test results, or Failure with execution errors
##### getAssertionStatistics
```php
public function getAssertionStatistics(
StoreInterface|string $store,
string $authorizationModelId,
): FailureInterface|SuccessInterface
```
Get assertion execution statistics. Provides insights into assertion test results, including pass/fail counts, execution times, and common failure patterns. Useful for monitoring authorization model health and test coverage.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionServiceInterface.php#L106)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------ | ---------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to analyze |
| `$authorizationModelId` | `string` | The authorization model to analyze |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with statistics, or Failure with error details
##### readAssertions
```php
public function readAssertions(string $authorizationModelId): FailureInterface|SuccessInterface
```
Read assertions from an authorization model. Retrieves all test assertions defined in the specified authorization model. Assertions validate that the model behaves correctly for specific scenarios.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionServiceInterface.php#L120)
###### Parameters
| Name | Type | Description |
| ----------------------- | -------- | ------------------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID containing assertions |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with assertions collection, or Failure with error details
##### validateAssertions
```php
public function validateAssertions(
AssertionsInterface $assertions,
string $authorizationModelId,
): FailureInterface|SuccessInterface
```
Validate assertion syntax and logic. Checks that assertions are properly formatted and reference valid types and relations from the authorization model. This helps catch errors before deploying assertions to production.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionServiceInterface.php#L135)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------------------- |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to validate |
| `$authorizationModelId` | `string` | The authorization model to validate against |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if valid, or Failure with validation errors
##### writeAssertions
```php
public function writeAssertions(
string $authorizationModelId,
AssertionsInterface $assertions,
): FailureInterface|SuccessInterface
```
Write assertions to an authorization model. Updates the test assertions for the specified authorization model. Assertions help validate that your authorization model works as expected by defining specific test cases and their expected outcomes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AssertionServiceInterface.php#L151)
###### Parameters
| Name | Type | Description |
| ----------------------- | ------------------------------------------------------------------ | ------------------------------------ |
| `$authorizationModelId` | `string` | The authorization model ID to update |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to write |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if written, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/AssertionServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/AuthenticationService.md -->
### AuthenticationService
Service implementation for managing authentication in OpenFGA operations. This service encapsulates all authentication-related logic, providing a clean abstraction over the underlying authentication strategies. It handles token management, authentication request flows, and integrates with telemetry for monitoring authentication performance and failures. The service supports multiple authentication strategies through the AuthenticationInterface, automatically handling token refresh and error recovery patterns. It provides consistent error handling and telemetry integration across all authentication operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAuthorizationHeader()`](#getauthorizationheader)
- [`sendAuthenticationRequest()`](#sendauthenticationrequest)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthenticationService.php)
#### Implements
- [`AuthenticationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/AuthenticationServiceInterface.md)
#### Related Classes
- [AuthenticationServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/AuthenticationServiceInterface.md) (interface)
#### Methods
##### getAuthorizationHeader
```php
public function getAuthorizationHeader(
Psr\Http\Message\StreamFactoryInterface $streamFactory,
?callable $requestSender = NULL,
): ?string
```
Get the authorization header for API requests. Retrieves the current authorization header, automatically handling token refresh if the current token is expired or missing. This method encapsulates the complexity of different authentication flows and provides a simple interface for obtaining valid authorization credentials.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthenticationService.php#L48)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | Stream factory for building authentication requests |
| `$requestSender` | `callable` | `null` | |
###### Returns
`string` | `null` — The authorization header value, or null if no authentication configured
##### sendAuthenticationRequest
```php
public function sendAuthenticationRequest(
OpenFGA\Network\RequestContext $context,
callable $requestSender,
): Psr\Http\Message\ResponseInterface
```
Send an authentication request using a pre-built RequestContext. Handles the complete lifecycle of authentication requests, including request building, sending, response handling, and telemetry tracking. This method provides a centralized point for all authentication-related HTTP operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthenticationService.php#L137)
###### Parameters
| Name | Type | Description |
| ---------------- | --------------------------------------------- | ---------------------------------- |
| `$context` | [`RequestContext`](https://github.com/evansims/openfga-php/blob/main/Network/RequestContext.md) | The authentication request context |
| `$requestSender` | `callable` | |
###### Returns
`Psr\Http\Message\ResponseInterface` — The authentication response
<!-- End of evansims/openfga-php/docs/API/Services/AuthenticationService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/AuthenticationServiceInterface.md -->
### AuthenticationServiceInterface
Service interface for managing authentication in OpenFGA operations. This service abstracts authentication concerns from the Client class, handling the complexities of token management, authentication flows, and authorization header generation. It provides a clean interface for different authentication strategies while encapsulating the details of token refresh and error handling. ## Core Functionality The service manages the complete authentication lifecycle: - Authorization header generation with automatic token refresh - Authentication request handling with proper error management - Support for multiple authentication strategies (OAuth2, pre-shared keys) - Integration with telemetry for authentication monitoring ## Usage Example ```php $authService = new AuthenticationService($authentication, $telemetryService); Get authorization header (with automatic refresh if needed) $authHeader = $authService->getAuthorizationHeader($streamFactory); Handle authentication requests $response = $authService->sendAuthenticationRequest($context, $requestManager); ```
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getAuthorizationHeader()`](#getauthorizationheader)
- [`sendAuthenticationRequest()`](#sendauthenticationrequest)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthenticationServiceInterface.php)
#### Related Classes
- [AuthenticationService](https://github.com/evansims/openfga-php/blob/main/Services/AuthenticationService.md) (implementation)
#### Methods
##### getAuthorizationHeader
```php
public function getAuthorizationHeader(
StreamFactoryInterface $streamFactory,
?callable $requestSender = NULL,
): string|null
```
Get the authorization header for API requests. Retrieves the current authorization header, automatically handling token refresh if the current token is expired or missing. This method encapsulates the complexity of different authentication flows and provides a simple interface for obtaining valid authorization credentials.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthenticationServiceInterface.php#L65)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------ | --------------------------------------------------- |
| `$streamFactory` | `StreamFactoryInterface` | Stream factory for building authentication requests |
| `$requestSender` | `callable` | `null` | |
###### Returns
`string` | `null` — The authorization header value, or null if no authentication configured
##### sendAuthenticationRequest
```php
public function sendAuthenticationRequest(RequestContext $context, callable $requestSender): HttpResponseInterface
```
Send an authentication request using a pre-built RequestContext. Handles the complete lifecycle of authentication requests, including request building, sending, response handling, and telemetry tracking. This method provides a centralized point for all authentication-related HTTP operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthenticationServiceInterface.php#L87)
###### Parameters
| Name | Type | Description |
| ---------------- | ---------------- | ---------------------------------- |
| `$context` | `RequestContext` | The authentication request context |
| `$requestSender` | `callable` | |
###### Returns
`HttpResponseInterface` — The authentication response
<!-- End of evansims/openfga-php/docs/API/Services/AuthenticationServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/AuthorizationService.md -->
### AuthorizationService
Service implementation for authorization operations. This service handles all authorization-related queries including permission checks, relationship expansions, and object/user listing. It delegates HTTP communication to the HttpServiceInterface and uses the Result pattern for consistent error handling. The service supports various consistency levels and contextual tuple evaluation for dynamic authorization scenarios. All operations are performed against a specific store and authorization model.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`batchCheck()`](#batchcheck)
- [`check()`](#check)
- [`expand()`](#expand)
- [`listObjects()`](#listobjects)
- [`listUsers()`](#listusers)
- [`streamedListObjects()`](#streamedlistobjects)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationService.php)
#### Implements
- [`AuthorizationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/AuthorizationServiceInterface.md)
#### Related Classes
- [AuthorizationServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/AuthorizationServiceInterface.md) (interface)
#### Methods
##### batchCheck
```php
public function batchCheck(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
OpenFGA\Models\Collections\BatchCheckItemsInterface $checks,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Performs multiple authorization checks in a single batch request. This method allows checking multiple user-object relationships simultaneously for better performance when multiple authorization decisions are needed. Each check in the batch has a correlation ID to map results back to the original requests.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationService.php#L59)
###### Parameters
| Name | Type | Description |
| --------- | -------------------------------------------------------------------------------------- | ------------------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$checks` | [`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/BatchCheckItemsInterface.md) | The batch check items with correlation IDs |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with BatchCheckResponse, or Failure with error details
##### check
```php
public function check(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
OpenFGA\Models\TupleKeyInterface $tupleKey,
?bool $trace = NULL,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Checks if a user has a specific relationship with an object. This method verifies whether the specified user has the given relationship (like 'reader', 'writer', or 'owner') with the target object. It's the core operation for making authorization decisions in your application.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationService.php#L90)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$tupleKey` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The relationship to check |
| `$trace` | `bool` | `null` | Whether to include a trace in the response |
| `$context` | `object` | `null` | Additional context for the check |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with CheckResponse, or Failure with error details
##### expand
```php
public function expand(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\TupleKeyInterface $tupleKey,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Expands a relationship tuple to show all users that have the relationship. This method recursively expands a relationship to reveal all users who have access through direct assignment, group membership, or computed relationships. It's useful for understanding why a user has a particular permission.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationService.php#L129)
###### Parameters
| Name | Type | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuple |
| `$tupleKey` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The tuple to expand |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | The authorization model to use |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ExpandResponse, or Failure with error details
##### listObjects
```php
public function listObjects(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists objects that have a specific relationship with a user. This method finds all objects of a given type that the specified user has a particular relationship with. It's useful for building filtered lists based on user permissions (for example "show all documents the user can read").
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationService.php#L164)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The type of objects to list |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ListObjectsResponse, or Failure with error details
##### listUsers
```php
public function listUsers(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
string $object,
string $relation,
OpenFGA\Models\Collections\UserTypeFiltersInterface $userFilters,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists users that have a specific relationship with an object. This method finds all users (and optionally groups) that have a particular relationship with a specific object. It's useful for auditing access or building user interfaces that show who has permissions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationService.php#L205)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$object` | `string` | The object to check relationships for |
| `$relation` | `string` | The relationship to check |
| `$userFilters` | [`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UserTypeFiltersInterface.md) | Filters for user types to include |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ListUsersResponse, or Failure with error details
##### streamedListObjects
```php
public function streamedListObjects(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists objects that a user has a specific relationship with using streaming. This method finds all objects of a given type where the specified user has the requested relationship, returning results as a stream for efficient processing of large datasets. The streaming approach is memory-efficient for large result sets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationService.php#L246)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The object type to filter by |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with Generator<StreamedListObjectsResponse>, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/AuthorizationService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/AuthorizationServiceInterface.md -->
### AuthorizationServiceInterface
Service interface for authorization operations. This interface defines methods for all authorization operations including permission checks, relationship expansions, and object/user listing. It provides a focused API for authorization decisions separate from store and model management operations.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`batchCheck()`](#batchcheck)
- [`check()`](#check)
- [`expand()`](#expand)
- [`listObjects()`](#listobjects)
- [`listUsers()`](#listusers)
- [`streamedListObjects()`](#streamedlistobjects)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationServiceInterface.php)
#### Related Classes
- [AuthorizationService](https://github.com/evansims/openfga-php/blob/main/Services/AuthorizationService.md) (implementation)
#### Methods
##### batchCheck
```php
public function batchCheck(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
BatchCheckItemsInterface $checks,
): FailureInterface|SuccessInterface
```
Performs multiple authorization checks in a single batch request. This method allows checking multiple user-object relationships simultaneously for better performance when multiple authorization decisions are needed. Each check in the batch has a correlation ID to map results back to the original requests.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationServiceInterface.php#L39)
###### Parameters
| Name | Type | Description |
| --------- | -------------------------------------------------------------------------------------- | ------------------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$checks` | [`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/BatchCheckItemsInterface.md) | The batch check items with correlation IDs |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with BatchCheckResponse, or Failure with error details
##### check
```php
public function check(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
TupleKeyInterface $tupleKey,
bool|null $trace = NULL,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Checks if a user has a specific relationship with an object. This method verifies whether the specified user has the given relationship (like 'reader', 'writer', or 'owner') with the target object. It's the core operation for making authorization decisions in your application.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationServiceInterface.php#L63)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$tupleKey` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The relationship to check |
| `$trace` | `bool` | `null` | Whether to include a trace in the response |
| `$context` | `object` | `null` | Additional context for the check |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with CheckResponse, or Failure with error details
##### expand
```php
public function expand(
StoreInterface|string $store,
TupleKeyInterface $tupleKey,
AuthorizationModelInterface|string|null $model = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Expands a relationship tuple to show all users that have the relationship. This method recursively expands a relationship to reveal all users who have access through direct assignment, group membership, or computed relationships. It's useful for understanding why a user has a particular permission.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationServiceInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuple |
| `$tupleKey` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The tuple to expand |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` | The authorization model to use |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ExpandResponse, or Failure with error details
##### listObjects
```php
public function listObjects(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Lists objects that have a specific relationship with a user. This method finds all objects of a given type that the specified user has a particular relationship with. It's useful for building filtered lists based on user permissions (for example "show all documents the user can read").
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationServiceInterface.php#L116)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The type of objects to list |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ListObjectsResponse, or Failure with error details
##### listUsers
```php
public function listUsers(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
string $object,
string $relation,
UserTypeFiltersInterface $userFilters,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Lists users that have a specific relationship with an object. This method finds all users (and optionally groups) that have a particular relationship with a specific object. It's useful for auditing access or building user interfaces that show who has permissions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationServiceInterface.php#L146)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$object` | `string` | The object to check relationships for |
| `$relation` | `string` | The relationship to check |
| `$userFilters` | [`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UserTypeFiltersInterface.md) | Filters for user types to include |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with ListUsersResponse, or Failure with error details
##### streamedListObjects
```php
public function streamedListObjects(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Lists objects that a user has a specific relationship with using streaming. This method finds all objects of a given type where the specified user has the requested relationship, returning results as a stream for efficient processing of large datasets. The streaming approach is memory-efficient for large result sets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/AuthorizationServiceInterface.php#L176)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The object type to filter by |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with Generator<StreamedListObjectsResponse>, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/AuthorizationServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/EventAwareTelemetryService.md -->
### EventAwareTelemetryService
Event-aware telemetry service that emits domain events. This service extends the base TelemetryService functionality by emitting domain events for operation lifecycle, enabling decoupled observability.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Methods](#methods)
- [`recordAuthenticationEvent()`](#recordauthenticationevent)
- [`recordFailure()`](#recordfailure)
- [`recordHttpRequest()`](#recordhttprequest)
- [`recordOperationMetrics()`](#recordoperationmetrics)
- [`recordSuccess()`](#recordsuccess)
- [`startOperation()`](#startoperation)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/EventAwareTelemetryService.php)
#### Implements
- [`TelemetryServiceInterface`](https://github.com/evansims/openfga-php/blob/main/TelemetryServiceInterface.md)
#### Methods
##### recordAuthenticationEvent
```php
public function recordAuthenticationEvent(
string $event,
bool $success,
float $duration,
array $attributes = [],
): void
```
Record an authentication event with duration and outcome. Tracks authentication-related operations including token acquisition, renewal, and validation. Provides insights into authentication performance and failure patterns.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/EventAwareTelemetryService.php#L40)
###### Parameters
| Name | Type | Description |
| ------------- | -------- | -------------------------------- |
| `$event` | `string` | The authentication event type |
| `$success` | `bool` | Whether the event was successful |
| `$duration` | `float` | Event duration in seconds |
| `$attributes` | `array` | |
###### Returns
`void`
##### recordFailure
```php
public function recordFailure(
OpenFGA\Services\TelemetryContext $context,
Throwable $exception,
mixed $result = NULL,
): void
```
Record a failed operation with error details. Completes an operation context with failure information, including exception details and any additional error context. This provides structured error tracking for debugging and monitoring.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/EventAwareTelemetryService.php#L53)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------ | ------------------------------------------- |
| `$context` | `TelemetryContext` | The operation context from startOperation() |
| `$exception` | `Throwable` | The exception that caused the failure |
| `$result` | `mixed` | Optional partial result data |
###### Returns
`void`
##### recordHttpRequest
```php
public function recordHttpRequest(
Psr\Http\Message\RequestInterface $request,
?Psr\Http\Message\ResponseInterface $response = NULL,
?Throwable $exception = NULL,
?float $duration = NULL,
): void
```
Record an HTTP request/response pair with automatic span management. Handles the complete lifecycle of HTTP request telemetry, including span creation, timing, and completion with response or error details. Ideal for tracking individual API calls.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/EventAwareTelemetryService.php#L102)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------------------------------- | --------------------------------- |
| `$request` | `Psr\Http\Message\RequestInterface` | The HTTP request being tracked |
| `$response` | `Psr\Http\Message\ResponseInterface` | `null` | The HTTP response received |
| `$exception` | `Throwable` | `null` | Optional exception that occurred |
| `$duration` | `float` | `null` | Optional manual duration override |
###### Returns
`void`
##### recordOperationMetrics
```php
public function recordOperationMetrics(
string $operation,
float $duration,
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
array $attributes = [],
): void
```
Record operational metrics for performance monitoring. Tracks operation-level metrics including timing, throughput, and contextual information about stores and models. Used for performance analysis and capacity planning.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/EventAwareTelemetryService.php#L119)
###### Parameters
| Name | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
| `$operation` | `string` | The operation name |
| `$duration` | `float` | Operation duration in seconds |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store context |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | Optional model context |
| `$attributes` | `array` | |
###### Returns
`void`
##### recordSuccess
```php
public function recordSuccess(OpenFGA\Services\TelemetryContext $context, mixed $result = NULL): void
```
Record a successful operation with results. Completes an operation context with success information and any relevant result data. This tracks successful operation patterns and performance characteristics.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/EventAwareTelemetryService.php#L133)
###### Parameters
| Name | Type | Description |
| ---------- | ------------------ | ------------------------------------------- |
| `$context` | `TelemetryContext` | The operation context from startOperation() |
| `$result` | `mixed` | The operation result data |
###### Returns
`void`
##### startOperation
```php
public function startOperation(
string $operation,
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
array $attributes = [],
): OpenFGA\Services\TelemetryContext
```
Start tracking a business operation. Creates a new telemetry context for tracking a complete business operation including timing, success/failure status, and contextual information. Returns a context object that should be passed to recordSuccess/recordFailure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/EventAwareTelemetryService.php#L175)
###### Parameters
| Name | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------- |
| `$operation` | `string` | The operation name |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store context |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | Optional model context |
| `$attributes` | `array` | |
###### Returns
`TelemetryContext` — Context for completing the operation tracking
<!-- End of evansims/openfga-php/docs/API/Services/EventAwareTelemetryService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/HttpService.md -->
### HttpService
Default implementation of HttpServiceInterface. This implementation delegates to RequestManager for actual HTTP operations, providing a clean abstraction layer between the Client and network concerns. It emits events for telemetry and observability without direct coupling.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getLastRequest()`](#getlastrequest)
- [`getLastResponse()`](#getlastresponse)
- [`send()`](#send)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpService.php)
#### Implements
- [`HttpServiceInterface`](https://github.com/evansims/openfga-php/blob/main/HttpServiceInterface.md)
#### Related Classes
- [HttpServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/HttpServiceInterface.md) (interface)
#### Methods
##### getLastRequest
```php
public function getLastRequest(): ?Psr\Http\Message\RequestInterface
```
Get the last HTTP request sent. Returns the most recent HTTP request sent by this service, useful for debugging and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpService.php#L52)
###### Returns
`Psr\Http\Message\RequestInterface` | `null` — The last request, or null if no requests sent
##### getLastResponse
```php
public function getLastResponse(): ?Psr\Http\Message\ResponseInterface
```
Get the last HTTP response received. Returns the most recent HTTP response received by this service, useful for debugging and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpService.php#L61)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null` — The last response, or null if no responses received
##### send
```php
public function send(OpenFGA\Requests\RequestInterface $request): Psr\Http\Message\ResponseInterface
```
Send an HTTP request. Sends a request to the OpenFGA API and returns the response. This method handles all HTTP-level concerns including authentication, retries, and error handling.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpService.php#L75)
###### Parameters
| Name | Type | Description |
| ---------- | -------------------------------------------------- | --------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The OpenFGA request to send |
###### Returns
`Psr\Http\Message\ResponseInterface` — The HTTP response
<!-- End of evansims/openfga-php/docs/API/Services/HttpService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/HttpServiceInterface.md -->
### HttpServiceInterface
Service for handling HTTP communication. This service abstracts HTTP operations from the Client class, providing a clean interface for sending requests and managing HTTP-related state like last request/response tracking.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`getLastRequest()`](#getlastrequest)
- [`getLastResponse()`](#getlastresponse)
- [`send()`](#send)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpServiceInterface.php)
#### Related Classes
- [HttpService](https://github.com/evansims/openfga-php/blob/main/Services/HttpService.md) (implementation)
#### Methods
##### getLastRequest
```php
public function getLastRequest(): HttpRequestInterface|null
```
Get the last HTTP request sent. Returns the most recent HTTP request sent by this service, useful for debugging and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpServiceInterface.php#L28)
###### Returns
`HttpRequestInterface` | `null` — The last request, or null if no requests sent
##### getLastResponse
```php
public function getLastResponse(): HttpResponseInterface|null
```
Get the last HTTP response received. Returns the most recent HTTP response received by this service, useful for debugging and error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpServiceInterface.php#L38)
###### Returns
`HttpResponseInterface` | `null` — The last response, or null if no responses received
##### send
```php
public function send(RequestInterface $request): HttpResponseInterface
```
Send an HTTP request. Sends a request to the OpenFGA API and returns the response. This method handles all HTTP-level concerns including authentication, retries, and error handling.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/HttpServiceInterface.php#L54)
###### Parameters
| Name | Type | Description |
| ---------- | -------------------------------------------------- | --------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The OpenFGA request to send |
###### Returns
`HttpResponseInterface` — The HTTP response
<!-- End of evansims/openfga-php/docs/API/Services/HttpServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/ModelService.md -->
### ModelService
Service implementation for managing OpenFGA authorization models. Provides business-focused operations for working with authorization models, including validation, convenience methods, and enhanced error handling. This service abstracts the underlying repository implementation and adds value through additional functionality.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`cloneModel()`](#clonemodel)
- [`createModel()`](#createmodel)
- [`findModel()`](#findmodel)
- [`getLatestModel()`](#getlatestmodel)
- [`listAllModels()`](#listallmodels)
- [`validateModel()`](#validatemodel)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelService.php)
#### Implements
- [`ModelServiceInterface`](https://github.com/evansims/openfga-php/blob/main/ModelServiceInterface.md)
#### Related Classes
- [ModelServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/ModelServiceInterface.md) (interface)
#### Methods
##### cloneModel
```php
public function cloneModel(string $modelId): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Clone an authorization model to another store. Copies a model from one store to another, useful for multi-tenant scenarios where you want to replicate a permission structure. The cloned model gets a new ID in the target store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelService.php#L52)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ---------------------------- |
| `$modelId` | `string` | The ID of the model to clone |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the cloned model, or Failure with error details
##### createModel
```php
public function createModel(
OpenFGA\Models\Collections\TypeDefinitionsInterface $typeDefinitions,
?OpenFGA\Models\Collections\ConditionsInterface $conditions = NULL,
OpenFGA\Models\Enums\SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Create a new authorization model with validation. Creates an immutable authorization model from the provided type definitions and optional conditions. The model is validated before creation to ensure it conforms to OpenFGA's schema requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelService.php#L78)
###### Parameters
| Name | Type | Description |
| ------------------ | -------------------------------------------------------------------------------- | ------------------------------------------------------ |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | The type definitions for the model |
| `$conditions` | [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` | Optional conditions for attribute-based access control |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The OpenFGA schema version to use |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the created model, or Failure with validation/creation errors
##### findModel
```php
public function findModel(string $modelId): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Find a specific authorization model by ID. Retrieves a model with enhanced error handling, providing clear messages when models are not found or other errors occur.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelService.php#L98)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ---------------------------------- |
| `$modelId` | `string` | The unique identifier of the model |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the model, or Failure with detailed error information
##### getLatestModel
```php
public function getLatestModel(OpenFGA\Models\StoreInterface|string $store): FailureInterface|Success
```
Get the most recent authorization model for a store. Retrieves the latest model version, which is typically the active model being used for authorization decisions. This is a convenience method that avoids needing to list all models and manually find the newest one.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelService.php#L116)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | -------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to get the latest model from |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`Success`](https://github.com/evansims/openfga-php/blob/main/Results/Success.md) — Success with the latest model, or Failure if no models exist
##### listAllModels
```php
public function listAllModels(
?string $continuationToken = NULL,
?int $pageSize = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
List all authorization models for a store. Retrieves all models with automatic pagination handling. This method aggregates results across multiple pages up to the specified limit.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelService.php#L147)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | -------------------------------------------------------------- |
| `$continuationToken` | `string` | `null` | Pagination token from a previous response |
| `$pageSize` | `int` | `null` | Maximum number of models to retrieve (null for server default) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the models collection, or Failure with error details
##### validateModel
```php
public function validateModel(
OpenFGA\Models\Collections\TypeDefinitionsInterface $typeDefinitions,
OpenFGA\Models\Enums\SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Validate type definitions before creating a model. Performs validation on type definitions to catch errors before attempting to create a model. This is useful for providing immediate feedback in user interfaces or validation pipelines.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelService.php#L160)
###### Parameters
| Name | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------------------------------- |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | The type definitions to validate |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The schema version to validate against |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if valid, or Failure with validation errors
<!-- End of evansims/openfga-php/docs/API/Services/ModelService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/ModelServiceInterface.md -->
### ModelServiceInterface
Service interface for managing OpenFGA authorization models. This service provides business-focused operations for working with authorization models, abstracting away the underlying repository implementation details and providing enhanced functionality like validation, cloning, and convenience methods. Authorization models define the permission structure for your application, including object types, relationships, and computation rules. Models are immutable once created, ensuring consistent authorization behavior. ## Core Operations The service supports model management with enhanced functionality: - Create models with comprehensive validation - Retrieve models with improved error handling - Clone models between stores for multi-tenant scenarios - Find the latest model version automatically ## Usage Example ```php $modelService = new ModelService($modelRepository); Create a new model with validation $result = $modelService->createModel( $store, $typeDefinitions, $conditions ); Get the latest model for a store $latest = $modelService->getLatestModel($store)->unwrap(); Clone a model to another store $cloned = $modelService->cloneModel( $sourceStore, $modelId, $targetStore )->unwrap(); ```
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`cloneModel()`](#clonemodel)
- [`createModel()`](#createmodel)
- [`findModel()`](#findmodel)
- [`getLatestModel()`](#getlatestmodel)
- [`listAllModels()`](#listallmodels)
- [`validateModel()`](#validatemodel)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelServiceInterface.php)
#### Related Classes
- [ModelService](https://github.com/evansims/openfga-php/blob/main/Services/ModelService.md) (implementation)
#### Methods
##### cloneModel
```php
public function cloneModel(string $modelId): FailureInterface|SuccessInterface
```
Clone an authorization model to another store. Copies a model from one store to another, useful for multi-tenant scenarios where you want to replicate a permission structure. The cloned model gets a new ID in the target store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelServiceInterface.php#L73)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ---------------------------- |
| `$modelId` | `string` | The ID of the model to clone |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the cloned model, or Failure with error details
##### createModel
```php
public function createModel(
TypeDefinitionsInterface $typeDefinitions,
ConditionsInterface|null $conditions = NULL,
SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
): FailureInterface|SuccessInterface
```
Create a new authorization model with validation. Creates an immutable authorization model from the provided type definitions and optional conditions. The model is validated before creation to ensure it conforms to OpenFGA's schema requirements.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelServiceInterface.php#L89)
###### Parameters
| Name | Type | Description |
| ------------------ | -------------------------------------------------------------------------------- | ------------------------------------------------------ |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | The type definitions for the model |
| `$conditions` | [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` | Optional conditions for attribute-based access control |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The OpenFGA schema version to use |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the created model, or Failure with validation/creation errors
##### findModel
```php
public function findModel(string $modelId): FailureInterface|SuccessInterface
```
Find a specific authorization model by ID. Retrieves a model with enhanced error handling, providing clear messages when models are not found or other errors occur.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelServiceInterface.php#L104)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | ---------------------------------- |
| `$modelId` | `string` | The unique identifier of the model |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the model, or Failure with detailed error information
##### getLatestModel
```php
public function getLatestModel(StoreInterface|string $store): FailureInterface|SuccessInterface
```
Get the most recent authorization model for a store. Retrieves the latest model version, which is typically the active model being used for authorization decisions. This is a convenience method that avoids needing to list all models and manually find the newest one.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelServiceInterface.php#L118)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | -------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to get the latest model from |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the latest model, or Failure if no models exist
##### listAllModels
```php
public function listAllModels(
string|null $continuationToken = NULL,
int|null $pageSize = NULL,
): FailureInterface|SuccessInterface
```
List all authorization models for a store. Retrieves all models with automatic pagination handling. This method aggregates results across multiple pages up to the specified limit.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelServiceInterface.php#L132)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | -------------------------------------------------------------- |
| `$continuationToken` | `string` | `null` | Pagination token from a previous response |
| `$pageSize` | `int` | `null` | Maximum number of models to retrieve (null for server default) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with the models collection, or Failure with error details
##### validateModel
```php
public function validateModel(
TypeDefinitionsInterface $typeDefinitions,
SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
): FailureInterface|SuccessInterface
```
Validate type definitions before creating a model. Performs validation on type definitions to catch errors before attempting to create a model. This is useful for providing immediate feedback in user interfaces or validation pipelines.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/ModelServiceInterface.php#L148)
###### Parameters
| Name | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------------------------------- |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | The type definitions to validate |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The schema version to validate against |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if valid, or Failure with validation errors
<!-- End of evansims/openfga-php/docs/API/Services/ModelServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/README.md -->
## Services
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Services
Business logic services that orchestrate between repositories and external systems.
**Total Components:** 19
### Interfaces
| Name | Description |
|------|-------------|
| [`AssertionServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./AssertionServiceInterface.md) | Service interface for managing OpenFGA authorization model assertions. This service provides busi... |
| [`AuthenticationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./AuthenticationServiceInterface.md) | Service interface for managing authentication in OpenFGA operations. This service abstracts authe... |
| [`AuthorizationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./AuthorizationServiceInterface.md) | Service interface for authorization operations. This interface defines methods for all authorizat... |
| [`HttpServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./HttpServiceInterface.md) | Service for handling HTTP communication. This service abstracts HTTP operations from the Client c... |
| [`ModelServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./ModelServiceInterface.md) | Service interface for managing OpenFGA authorization models. This service provides business-focus... |
| [`StoreServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./StoreServiceInterface.md) | Service interface for high-level store operations. This interface provides a business-focused abs... |
| [`TelemetryServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./TelemetryServiceInterface.md) | Service interface for managing telemetry and observability in OpenFGA operations. This service pr... |
| [`TupleFilterServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleFilterServiceInterface.md) | Service for filtering and deduplicating tuple operations. This service encapsulates the business ... |
| [`TupleServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./TupleServiceInterface.md) | Service interface for managing OpenFGA relationship tuples. This service provides business-focuse... |
### Classes
| Name | Description |
|------|-------------|
| [`AssertionService`](https://github.com/evansims/openfga-php/blob/main/./AssertionService.md) | Service implementation for managing OpenFGA authorization model assertions. Provides business-foc... |
| [`AuthenticationService`](https://github.com/evansims/openfga-php/blob/main/./AuthenticationService.md) | Service implementation for managing authentication in OpenFGA operations. This service encapsulat... |
| [`AuthorizationService`](https://github.com/evansims/openfga-php/blob/main/./AuthorizationService.md) | Service implementation for authorization operations. This service handles all authorization-relat... |
| [`EventAwareTelemetryService`](https://github.com/evansims/openfga-php/blob/main/./EventAwareTelemetryService.md) | Event-aware telemetry service that emits domain events. This service extends the base TelemetrySe... |
| [`HttpService`](https://github.com/evansims/openfga-php/blob/main/./HttpService.md) | Default implementation of HttpServiceInterface. This implementation delegates to RequestManager f... |
| [`ModelService`](https://github.com/evansims/openfga-php/blob/main/./ModelService.md) | Service implementation for managing OpenFGA authorization models. Provides business-focused opera... |
| [`StoreService`](https://github.com/evansims/openfga-php/blob/main/./StoreService.md) | Service implementation for high-level store operations. This service provides business-focused ab... |
| [`TelemetryService`](https://github.com/evansims/openfga-php/blob/main/./TelemetryService.md) | Service implementation for managing telemetry and observability in OpenFGA operations. Provides a... |
| [`TupleFilterService`](https://github.com/evansims/openfga-php/blob/main/./TupleFilterService.md) | Default implementation of TupleFilterServiceInterface. Provides efficient duplicate filtering for... |
| [`TupleService`](https://github.com/evansims/openfga-php/blob/main/./TupleService.md) | Service implementation for managing OpenFGA relationship tuples. Provides business-focused operat... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Services/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/StoreService.md -->
### StoreService
Service implementation for high-level store operations. This service provides business-focused abstractions over the StoreRepository, adding validation, convenience methods, and enhanced error messages. It handles common store management patterns while maintaining consistency with the SDK's Result pattern for error handling. The service is designed to simplify store operations for application developers by providing intuitive methods that handle edge cases and provide clear feedback.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`createStore()`](#createstore)
- [`deleteStore()`](#deletestore)
- [`findStore()`](#findstore)
- [`findStoresByName()`](#findstoresbyname)
- [`getOrCreateStore()`](#getorcreatestore)
- [`listAllStores()`](#listallstores)
- [`listStores()`](#liststores)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php)
#### Implements
- [`StoreServiceInterface`](https://github.com/evansims/openfga-php/blob/main/StoreServiceInterface.md)
#### Related Classes
- [StoreServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/StoreServiceInterface.md) (interface)
#### Methods
##### createStore
```php
public function createStore(string $name): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Creates a new store with validation. This method creates a new OpenFGA store after validating the provided name. It ensures the name meets requirements before attempting creation, providing clearer error messages than the raw API when validation fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php#L68)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ---------------------------------------------- |
| `$name` | `string` | The name for the new store (must not be empty) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing the created Store, or Failure with error details
##### deleteStore
```php
public function deleteStore(
string $storeId,
bool $confirmExists = true,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Deletes a store with optional confirmation. This method deletes a store after optionally verifying it exists first. When confirmation is enabled, it provides clearer error messages if the store doesn't exist, preventing confusion about failed delete operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php#L109)
###### Parameters
| Name | Type | Description |
| ---------------- | -------- | -------------------------------------------------- |
| `$storeId` | `string` | The ID of the store to delete |
| `$confirmExists` | `bool` | Whether to verify the store exists before deletion |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with null value, or Failure with error details
##### findStore
```php
public function findStore(string $storeId): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Finds a store by ID with enhanced error handling. This method retrieves a store by its ID, providing more descriptive error messages when the store is not found or when other errors occur. It helps distinguish between "not found" and other types of failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php#L133)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | --------------------------- |
| `$storeId` | `string` | The ID of the store to find |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing the Store, or Failure with detailed error context
##### findStoresByName
```php
public function findStoresByName(
string $pattern,
?int $maxItems = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Finds stores by name pattern. This method searches for stores whose names match a given pattern, supporting basic wildcard matching. It's useful for finding stores in multi-tenant scenarios or when working with naming conventions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php#L171)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------- | -------------------------------------------------- |
| `$pattern` | `string` | The name pattern to match (supports * as wildcard) |
| `$maxItems` | `int` | `null` | Maximum number of matching stores to return |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing Stores collection of matches, or Failure with error details
##### getOrCreateStore
```php
public function getOrCreateStore(string $name): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Gets an existing store or creates a new one with the given name. This convenience method first attempts to find a store by name among existing stores. If no store with the given name exists, it creates a new one. This is useful for idempotent store setup in development or testing scenarios. Note: This method lists all stores to find matches by name, which may be inefficient with large numbers of stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php#L216)
###### Parameters
| Name | Type | Description |
| ------- | -------- | --------------------------------------- |
| `$name` | `string` | The name of the store to find or create |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing the Store (existing or new), or Failure with error details
##### listAllStores
```php
public function listAllStores(?int $maxItems = NULL): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists all stores with simplified pagination. This method retrieves all accessible stores, automatically handling pagination to return a complete collection. It abstracts away the complexity of dealing with continuation tokens for most use cases.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php#L257)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------- | --------------------------------------------------- |
| `$maxItems` | `int` | `null` | Maximum number of stores to retrieve (null for all) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing Stores collection, or Failure with error details
##### listStores
```php
public function listStores(
?string $continuationToken = NULL,
?int $pageSize = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists stores with pagination support. This method retrieves stores with explicit pagination control, allowing you to specify continuation tokens for iterating through large result sets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreService.php#L299)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | --------------------------------------------- |
| `$continuationToken` | `string` | `null` | Token from previous response to get next page |
| `$pageSize` | `int` | `null` | Maximum number of stores to return per page |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing Stores collection, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/StoreService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/StoreServiceInterface.md -->
### StoreServiceInterface
Service interface for high-level store operations. This interface provides a business-focused abstraction over store management, offering convenience methods and enhanced validation beyond basic CRUD operations. It simplifies common store workflows while maintaining the Result pattern for consistent error handling across the SDK.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`createStore()`](#createstore)
- [`deleteStore()`](#deletestore)
- [`findStore()`](#findstore)
- [`findStoresByName()`](#findstoresbyname)
- [`getOrCreateStore()`](#getorcreatestore)
- [`listAllStores()`](#listallstores)
- [`listStores()`](#liststores)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php)
#### Related Classes
- [StoreService](https://github.com/evansims/openfga-php/blob/main/Services/StoreService.md) (implementation)
#### Methods
##### createStore
```php
public function createStore(string $name): FailureInterface|SuccessInterface
```
Creates a new store with validation. This method creates a new OpenFGA store after validating the provided name. It ensures the name meets requirements before attempting creation, providing clearer error messages than the raw API when validation fails.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php#L33)
###### Parameters
| Name | Type | Description |
| ------- | -------- | ---------------------------------------------- |
| `$name` | `string` | The name for the new store (must not be empty) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing the created Store, or Failure with error details
##### deleteStore
```php
public function deleteStore(string $storeId, bool $confirmExists = true): FailureInterface|SuccessInterface
```
Deletes a store with optional confirmation. This method deletes a store after optionally verifying it exists first. When confirmation is enabled, it provides clearer error messages if the store doesn't exist, preventing confusion about failed delete operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php#L48)
###### Parameters
| Name | Type | Description |
| ---------------- | -------- | -------------------------------------------------- |
| `$storeId` | `string` | The ID of the store to delete |
| `$confirmExists` | `bool` | Whether to verify the store exists before deletion |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with null value, or Failure with error details
##### findStore
```php
public function findStore(string $storeId): FailureInterface|SuccessInterface
```
Finds a store by ID with enhanced error handling. This method retrieves a store by its ID, providing more descriptive error messages when the store is not found or when other errors occur. It helps distinguish between "not found" and other types of failures.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php#L62)
###### Parameters
| Name | Type | Description |
| ---------- | -------- | --------------------------- |
| `$storeId` | `string` | The ID of the store to find |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing the Store, or Failure with detailed error context
##### findStoresByName
```php
public function findStoresByName(string $pattern, int|null $maxItems = NULL): FailureInterface|SuccessInterface
```
Finds stores by name pattern. This method searches for stores whose names match a given pattern, supporting basic wildcard matching. It's useful for finding stores in multi-tenant scenarios or when working with naming conventions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php#L75)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------- | -------------------------------------------------- |
| `$pattern` | `string` | The name pattern to match (supports * as wildcard) |
| `$maxItems` | `int` | `null` | Maximum number of matching stores to return |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing Stores collection of matches, or Failure with error details
##### getOrCreateStore
```php
public function getOrCreateStore(string $name): FailureInterface|SuccessInterface
```
Gets an existing store or creates a new one with the given name. This convenience method first attempts to find a store by name among existing stores. If no store with the given name exists, it creates a new one. This is useful for idempotent store setup in development or testing scenarios. Note: This method lists all stores to find matches by name, which may be inefficient with large numbers of stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php#L90)
###### Parameters
| Name | Type | Description |
| ------- | -------- | --------------------------------------- |
| `$name` | `string` | The name of the store to find or create |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing the Store (existing or new), or Failure with error details
##### listAllStores
```php
public function listAllStores(int|null $maxItems = NULL): FailureInterface|SuccessInterface
```
Lists all stores with simplified pagination. This method retrieves all accessible stores, automatically handling pagination to return a complete collection. It abstracts away the complexity of dealing with continuation tokens for most use cases.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php#L104)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------- | --------------------------------------------------- |
| `$maxItems` | `int` | `null` | Maximum number of stores to retrieve (null for all) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing Stores collection, or Failure with error details
##### listStores
```php
public function listStores(
string|null $continuationToken = NULL,
int|null $pageSize = NULL,
): FailureInterface|SuccessInterface
```
Lists stores with pagination support. This method retrieves stores with explicit pagination control, allowing you to specify continuation tokens for iterating through large result sets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/StoreServiceInterface.php#L118)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | --------------------------------------------- |
| `$continuationToken` | `string` | `null` | Token from previous response to get next page |
| `$pageSize` | `int` | `null` | Maximum number of stores to return per page |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success containing Stores collection, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/StoreServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/TelemetryService.md -->
### TelemetryService
Service implementation for managing telemetry and observability in OpenFGA operations. Provides a higher-level abstraction over the telemetry infrastructure, simplifying the creation and management of telemetry spans, metrics, and events. This service handles common telemetry patterns and provides business-focused methods for tracking operations, performance, and errors.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`recordAuthenticationEvent()`](#recordauthenticationevent)
- [`recordFailure()`](#recordfailure)
- [`recordHttpRequest()`](#recordhttprequest)
- [`recordOperationMetrics()`](#recordoperationmetrics)
- [`recordSuccess()`](#recordsuccess)
- [`startOperation()`](#startoperation)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryService.php)
#### Implements
- [`TelemetryServiceInterface`](https://github.com/evansims/openfga-php/blob/main/TelemetryServiceInterface.md)
#### Related Classes
- [TelemetryServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/TelemetryServiceInterface.md) (interface)
#### Methods
##### recordAuthenticationEvent
```php
public function recordAuthenticationEvent(
string $event,
bool $success,
float $duration,
array $attributes = [],
): void
```
Record an authentication event with duration and outcome. Tracks authentication-related operations including token acquisition, renewal, and validation. Provides insights into authentication performance and failure patterns.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryService.php#L40)
###### Parameters
| Name | Type | Description |
| ------------- | -------- | -------------------------------- |
| `$event` | `string` | The authentication event type |
| `$success` | `bool` | Whether the event was successful |
| `$duration` | `float` | Event duration in seconds |
| `$attributes` | `array` | |
###### Returns
`void`
##### recordFailure
```php
public function recordFailure(
OpenFGA\Services\TelemetryContext $context,
Throwable $exception,
mixed $result = NULL,
): void
```
Record a failed operation with error details. Completes an operation context with failure information, including exception details and any additional error context. This provides structured error tracking for debugging and monitoring.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryService.php#L53)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------ | ------------------------------------------- |
| `$context` | `TelemetryContext` | The operation context from startOperation() |
| `$exception` | `Throwable` | The exception that caused the failure |
| `$result` | `mixed` | Optional partial result data |
###### Returns
`void`
##### recordHttpRequest
```php
public function recordHttpRequest(
Psr\Http\Message\RequestInterface $request,
?Psr\Http\Message\ResponseInterface $response = NULL,
?Throwable $exception = NULL,
?float $duration = NULL,
): void
```
Record an HTTP request/response pair with automatic span management. Handles the complete lifecycle of HTTP request telemetry, including span creation, timing, and completion with response or error details. Ideal for tracking individual API calls.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryService.php#L95)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------------------------------- | --------------------------------- |
| `$request` | `Psr\Http\Message\RequestInterface` | The HTTP request being tracked |
| `$response` | `Psr\Http\Message\ResponseInterface` | `null` | The HTTP response received |
| `$exception` | `Throwable` | `null` | Optional exception that occurred |
| `$duration` | `float` | `null` | Optional manual duration override |
###### Returns
`void`
##### recordOperationMetrics
```php
public function recordOperationMetrics(
string $operation,
float $duration,
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
array $attributes = [],
): void
```
Record operational metrics for performance monitoring. Tracks operation-level metrics including timing, throughput, and contextual information about stores and models. Used for performance analysis and capacity planning.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryService.php#L112)
###### Parameters
| Name | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
| `$operation` | `string` | The operation name |
| `$duration` | `float` | Operation duration in seconds |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store context |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | Optional model context |
| `$attributes` | `array` | |
###### Returns
`void`
##### recordSuccess
```php
public function recordSuccess(OpenFGA\Services\TelemetryContext $context, mixed $result = NULL): void
```
Record a successful operation with results. Completes an operation context with success information and any relevant result data. This tracks successful operation patterns and performance characteristics.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryService.php#L126)
###### Parameters
| Name | Type | Description |
| ---------- | ------------------ | ------------------------------------------- |
| `$context` | `TelemetryContext` | The operation context from startOperation() |
| `$result` | `mixed` | The operation result data |
###### Returns
`void`
##### startOperation
```php
public function startOperation(
string $operation,
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
array $attributes = [],
): OpenFGA\Services\TelemetryContext
```
Start tracking a business operation. Creates a new telemetry context for tracking a complete business operation including timing, success/failure status, and contextual information. Returns a context object that should be passed to recordSuccess/recordFailure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryService.php#L159)
###### Parameters
| Name | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------- |
| `$operation` | `string` | The operation name |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store context |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | Optional model context |
| `$attributes` | `array` | |
###### Returns
`TelemetryContext` — Context for completing the operation tracking
<!-- End of evansims/openfga-php/docs/API/Services/TelemetryService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/TelemetryServiceInterface.md -->
### TelemetryServiceInterface
Service interface for managing telemetry and observability in OpenFGA operations. This service provides a higher-level abstraction over the telemetry infrastructure, handling the creation, management, and coordination of telemetry spans, metrics, and events. It simplifies telemetry usage by providing business-focused methods that handle common patterns like operation timing and error tracking. ## Core Functionality The service manages the lifecycle of telemetry data for: - HTTP requests and responses with automatic span management - Business operations with timing and success/failure tracking - Error and exception handling with contextual information - Performance metrics and operational insights ## Usage Example ```php $telemetryService = new TelemetryService($telemetryProvider); Track a complete operation $context = $telemetryService->startOperation('check', $store, $model); try { $result = $businessLogic(); $telemetryService->recordSuccess($context, $result); return $result; } catch (Throwable $error) { $telemetryService->recordFailure($context, $error); throw $error; } ```
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`recordAuthenticationEvent()`](#recordauthenticationevent)
- [`recordFailure()`](#recordfailure)
- [`recordHttpRequest()`](#recordhttprequest)
- [`recordOperationMetrics()`](#recordoperationmetrics)
- [`recordSuccess()`](#recordsuccess)
- [`startOperation()`](#startoperation)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryServiceInterface.php)
#### Related Classes
- [TelemetryService](https://github.com/evansims/openfga-php/blob/main/Services/TelemetryService.md) (implementation)
#### Methods
##### recordAuthenticationEvent
```php
public function recordAuthenticationEvent(
string $event,
bool $success,
float $duration,
array<string, mixed> $attributes = [],
): void
```
Record an authentication event with duration and outcome. Tracks authentication-related operations including token acquisition, renewal, and validation. Provides insights into authentication performance and failure patterns.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryServiceInterface.php#L60)
###### Parameters
| Name | Type | Description |
| ------------- | -------------------------------- | -------------------------------- |
| `$event` | `string` | The authentication event type |
| `$success` | `bool` | Whether the event was successful |
| `$duration` | `float` | Event duration in seconds |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`void`
##### recordFailure
```php
public function recordFailure(TelemetryContext $context, Throwable $exception, mixed $result = NULL): void
```
Record a failed operation with error details. Completes an operation context with failure information, including exception details and any additional error context. This provides structured error tracking for debugging and monitoring.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryServiceInterface.php#L78)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------ | ------------------------------------------- |
| `$context` | `TelemetryContext` | The operation context from startOperation() |
| `$exception` | `Throwable` | The exception that caused the failure |
| `$result` | `mixed` | Optional partial result data |
###### Returns
`void`
##### recordHttpRequest
```php
public function recordHttpRequest(
RequestInterface $request,
ResponseInterface|null $response = NULL,
Throwable|null $exception = NULL,
float|null $duration = NULL,
): void
```
Record an HTTP request/response pair with automatic span management. Handles the complete lifecycle of HTTP request telemetry, including span creation, timing, and completion with response or error details. Ideal for tracking individual API calls.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryServiceInterface.php#L96)
###### Parameters
| Name | Type | Description |
| ------------ | ------------------------------------------------------------------- | --------------------------------- |
| `$request` | [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/Requests/RequestInterface.md) | The HTTP request being tracked |
| `$response` | [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/Responses/ResponseInterface.md) | `null` | The HTTP response received |
| `$exception` | `Throwable` | `null` | Optional exception that occurred |
| `$duration` | `float` | `null` | Optional manual duration override |
###### Returns
`void`
##### recordOperationMetrics
```php
public function recordOperationMetrics(
string $operation,
float $duration,
StoreInterface|string $store,
AuthorizationModelInterface|string|null $model = NULL,
array<string, mixed> $attributes = [],
): void
```
Record operational metrics for performance monitoring. Tracks operation-level metrics including timing, throughput, and contextual information about stores and models. Used for performance analysis and capacity planning.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryServiceInterface.php#L116)
###### Parameters
| Name | Type | Description |
| ------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------- |
| `$operation` | `string` | The operation name |
| `$duration` | `float` | Operation duration in seconds |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store context |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` | Optional model context |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`void`
##### recordSuccess
```php
public function recordSuccess(TelemetryContext $context, mixed $result = NULL): void
```
Record a successful operation with results. Completes an operation context with success information and any relevant result data. This tracks successful operation patterns and performance characteristics.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryServiceInterface.php#L134)
###### Parameters
| Name | Type | Description |
| ---------- | ------------------ | ------------------------------------------- |
| `$context` | `TelemetryContext` | The operation context from startOperation() |
| `$result` | `mixed` | The operation result data |
###### Returns
`void`
##### startOperation
```php
public function startOperation(
string $operation,
StoreInterface|string $store,
AuthorizationModelInterface|string|null $model = NULL,
array<string, mixed> $attributes = [],
): TelemetryContext
```
Start tracking a business operation. Creates a new telemetry context for tracking a complete business operation including timing, success/failure status, and contextual information. Returns a context object that should be passed to recordSuccess/recordFailure.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TelemetryServiceInterface.php#L152)
###### Parameters
| Name | Type | Description |
| ------------- | ---------------------------------------------------------------------------------------------------- | ---------------------- |
| `$operation` | `string` | The operation name |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store context |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` | Optional model context |
| `$attributes` | `array<`string`, `mixed`>` | |
###### Returns
`TelemetryContext` — Context for completing the operation tracking
<!-- End of evansims/openfga-php/docs/API/Services/TelemetryServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/TupleFilterService.md -->
### TupleFilterService
Default implementation of TupleFilterServiceInterface. Provides efficient duplicate filtering for tuple operations using hash-based lookups to ensure O(n) complexity.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`filterDuplicates()`](#filterduplicates)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleFilterService.php)
#### Implements
- [`TupleFilterServiceInterface`](https://github.com/evansims/openfga-php/blob/main/TupleFilterServiceInterface.md)
#### Related Classes
- [TupleFilterServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/TupleFilterServiceInterface.md) (interface)
#### Methods
##### filterDuplicates
```php
public function filterDuplicates(
?OpenFGA\Models\Collections\TupleKeysInterface $writes,
?OpenFGA\Models\Collections\TupleKeysInterface $deletes,
): array
```
Filter duplicate tuples from writes and deletes collections. This method ensures that: 1. No duplicate tuples exist within the writes collection 2. No duplicate tuples exist within the deletes collection 3. If a tuple appears in both writes and deletes, it's removed from writes (delete takes precedence to ensure the final state is deletion)
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleFilterService.php#L26)
###### Parameters
| Name | Type | Description |
| ---------- | ------------------------------------------------------------------------------ | --------------------- |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The writes to filter |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The deletes to filter |
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Services/TupleFilterService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/TupleFilterServiceInterface.md -->
### TupleFilterServiceInterface
Service for filtering and deduplicating tuple operations. This service encapsulates the business logic for handling duplicate tuples in write and delete operations, ensuring that: - No duplicate tuples exist within writes or deletes - Delete operations take precedence over writes when conflicts occur - Order is preserved based on first occurrence
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`filterDuplicates()`](#filterduplicates)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleFilterServiceInterface.php)
#### Related Classes
- [TupleFilterService](https://github.com/evansims/openfga-php/blob/main/Services/TupleFilterService.md) (implementation)
#### Methods
##### filterDuplicates
```php
public function filterDuplicates(TupleKeysInterface|null $writes, TupleKeysInterface|null $deletes): array
```
Filter duplicate tuples from writes and deletes collections. This method ensures that: 1. No duplicate tuples exist within the writes collection 2. No duplicate tuples exist within the deletes collection 3. If a tuple appears in both writes and deletes, it's removed from writes (delete takes precedence to ensure the final state is deletion)
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleFilterServiceInterface.php#L33)
###### Parameters
| Name | Type | Description |
| ---------- | ------------------------------------------------------------------------------ | --------------------- |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The writes to filter |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The deletes to filter |
###### Returns
`array`
<!-- End of evansims/openfga-php/docs/API/Services/TupleFilterServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/TupleService.md -->
### TupleService
Service implementation for managing OpenFGA relationship tuples. Provides business-focused operations for working with relationship tuples, which represent the core relationships in your authorization model. This service abstracts the underlying repository implementation and adds value through validation, duplicate filtering, and enhanced error handling.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`delete()`](#delete)
- [`deleteBatch()`](#deletebatch)
- [`exists()`](#exists)
- [`getStatistics()`](#getstatistics)
- [`listChanges()`](#listchanges)
- [`read()`](#read)
- [`write()`](#write)
- [`writeBatch()`](#writebatch)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php)
#### Implements
- [`TupleServiceInterface`](https://github.com/evansims/openfga-php/blob/main/TupleServiceInterface.md)
#### Related Classes
- [TupleServiceInterface](https://github.com/evansims/openfga-php/blob/main/Services/TupleServiceInterface.md) (interface)
#### Methods
##### delete
```php
public function delete(
OpenFGA\Models\StoreInterface|string $store,
string $user,
string $relation,
string $object,
bool $confirmExists = false,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Delete a single relationship tuple. Removes the specified relationship, with optional existence checking to provide better error messages when the tuple doesn't exist.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L59)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------------------------------------------ | -------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuple |
| `$user` | `string` | The user identifier |
| `$relation` | `string` | The relationship type |
| `$object` | `string` | The object identifier |
| `$confirmExists` | `bool` | Whether to check tuple exists before deletion (default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if deleted, or Failure with error details
##### deleteBatch
```php
public function deleteBatch(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\Collections\TupleKeysInterface $tupleKeys,
bool $transactional = true,
bool $confirmExists = false,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Delete multiple relationship tuples in a batch operation. Efficiently removes multiple tuples, with automatic chunking and optional existence checking for better error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L95)
###### Parameters
| Name | Type | Description |
| ---------------- | ---------------------------------------------------------------- | -------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuples |
| `$tupleKeys` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | The tuples to delete |
| `$transactional` | `bool` | Whether to use transactional deletes (default: true) |
| `$confirmExists` | `bool` | Whether to check tuples exist before deletion (default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if all deleted, or Failure with error details
##### exists
```php
public function exists(
OpenFGA\Models\StoreInterface|string $store,
string $user,
string $relation,
string $object,
): OpenFGA\Results\SuccessInterface
```
Check if a specific tuple exists in the store. Efficiently verifies tuple existence without retrieving all matching tuples. Useful for validation before operations or conditional logic.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L127)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------ | --------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check |
| `$user` | `string` | The user identifier |
| `$relation` | `string` | The relationship type |
| `$object` | `string` | The object identifier |
###### Returns
[`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with true/false, or Failure with error details
##### getStatistics
```php
public function getStatistics(OpenFGA\Models\StoreInterface|string $store): OpenFGA\Results\SuccessInterface
```
Get statistics about tuples in the store. Provides insights into the tuple distribution and counts by type and relation, useful for monitoring and capacity planning.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L145)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | -------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to analyze |
###### Returns
[`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with statistics array, or Failure with error details
##### listChanges
```php
public function listChanges(
OpenFGA\Models\StoreInterface|string $store,
?string $type = NULL,
?DateTimeImmutable $startTime = NULL,
?string $continuationToken = NULL,
?int $pageSize = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
List changes to tuples over time for auditing purposes. Retrieves a chronological log of tuple changes (writes and deletes) within the specified time range, useful for compliance and debugging.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L165)
###### Parameters
| Name | Type | Description |
| -------------------- | ------------------------------------------------------------ | ---------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to list changes from |
| `$type` | `string` | `null` | Filter by object type (optional) |
| `$startTime` | `DateTimeImmutable` | `null` | Start time for changes (optional) |
| `$continuationToken` | `string` | `null` | Token for pagination (optional) |
| `$pageSize` | `int` | `null` | Maximum number of changes to retrieve (default: 100) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with changes collection, or Failure with error details
##### read
```php
public function read(
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\TupleKeyInterface $tupleKey = NULL,
?string $continuationToken = NULL,
?int $pageSize = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Read relationship tuples with optional filtering. Retrieves tuples matching the specified criteria, with automatic pagination handling for large result sets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L199)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------------------------------------------------- | --------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to read from |
| `$tupleKey` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | `null` | The tuple key to filter by (optional) |
| `$continuationToken` | `string` | `null` | Token for pagination (optional) |
| `$pageSize` | `int` | `null` | Maximum number of tuples to retrieve (null for all) |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Read consistency level (optional) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with tuples collection, or Failure with error details
##### write
```php
public function write(
OpenFGA\Models\StoreInterface|string $store,
string $user,
string $relation,
string $object,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Write a single relationship tuple. Creates a relationship between a user and an object with the specified relation. This is the most common operation for establishing permissions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L237)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------ | -------------------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store where the tuple will be written |
| `$user` | `string` | The user identifier (for example 'user:anne') |
| `$relation` | `string` | The relationship type (for example 'reader', 'writer') |
| `$object` | `string` | The object identifier (for example 'document:budget-2024') |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if written, or Failure with error details
##### writeBatch
```php
public function writeBatch(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
?OpenFGA\Models\Collections\TupleKeysInterface $writes = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $deletes = NULL,
bool $transactional = true,
int $maxParallelRequests = 1,
int $maxTuplesPerChunk = 100,
int $maxRetries = 0,
float $retryDelaySeconds = 1.0,
bool $stopOnFirstError = false,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Write multiple relationship tuples in a batch operation. Efficiently writes multiple tuples, with automatic chunking to respect API limits and optional duplicate filtering for performance optimization.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleService.php#L273)
###### Parameters
| Name | Type | Description |
| ---------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store where tuples will be written |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The tuples to write (optional) |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The tuples to delete (optional) |
| `$transactional` | `bool` | Whether to use transactional writes (default: true) |
| `$maxParallelRequests` | `int` | Maximum parallel requests (default: 1) |
| `$maxTuplesPerChunk` | `int` | Maximum tuples per chunk (default: 100) |
| `$maxRetries` | `int` | Maximum retries (default: 0) |
| `$retryDelaySeconds` | `float` | Retry delay in seconds (default: 1.0) |
| `$stopOnFirstError` | `bool` | Whether to stop on first error (default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if all written, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/TupleService.md -->
<!-- Source: evansims/openfga-php/docs/API/Services/TupleServiceInterface.md -->
### TupleServiceInterface
Service interface for managing OpenFGA relationship tuples. This service provides business-focused operations for working with relationship tuples, which represent the core relationships in your authorization model. Tuples define who has what relationship to which objects, forming the foundation of your permission system. ## Core Operations The service supports tuple management with enhanced functionality: - Write tuples with validation and duplicate filtering - Read tuples with flexible filtering and pagination - Delete tuples safely with existence checking - Track tuple changes over time for auditing ## Batch Operations For high-throughput scenarios, the service provides: - Batch writes for multiple tuples in a single operation - Transaction support for atomicity guarantees - Automatic chunking to respect API limits - Duplicate filtering to optimize performance ## Usage Example ```php $tupleService = new TupleService($tupleRepository); Write a single tuple $result = $tupleService->write( $store, 'user:anne', 'reader', 'document:budget-2024' ); Read tuples with filters $tuples = $tupleService->read( $store, user: 'user:anne', relation: 'reader' )->unwrap(); Write multiple tuples $batch = $tupleService->writeBatch($store, $tupleKeys)->unwrap(); ```
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`delete()`](#delete)
- [`deleteBatch()`](#deletebatch)
- [`exists()`](#exists)
- [`getStatistics()`](#getstatistics)
- [`listChanges()`](#listchanges)
- [`read()`](#read)
- [`write()`](#write)
- [`writeBatch()`](#writebatch)
</details>
#### Namespace
`OpenFGA\Services`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php)
#### Related Classes
- [TupleService](https://github.com/evansims/openfga-php/blob/main/Services/TupleService.md) (implementation)
#### Methods
##### delete
```php
public function delete(
StoreInterface|string $store,
string $user,
string $relation,
string $object,
bool $confirmExists = false,
): FailureInterface|SuccessInterface
```
Delete a single relationship tuple. Removes the specified relationship, with optional existence checking to provide better error messages when the tuple doesn't exist.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L79)
###### Parameters
| Name | Type | Description |
| ---------------- | ------------------------------------------------------------ | -------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuple |
| `$user` | `string` | The user identifier |
| `$relation` | `string` | The relationship type |
| `$object` | `string` | The object identifier |
| `$confirmExists` | `bool` | Whether to check tuple exists before deletion (default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if deleted, or Failure with error details
##### deleteBatch
```php
public function deleteBatch(
StoreInterface|string $store,
TupleKeysInterface $tupleKeys,
bool $transactional = true,
bool $confirmExists = false,
): FailureInterface|SuccessInterface
```
Delete multiple relationship tuples in a batch operation. Efficiently removes multiple tuples, with automatic chunking and optional existence checking for better error reporting.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L99)
###### Parameters
| Name | Type | Description |
| ---------------- | ---------------------------------------------------------------- | -------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuples |
| `$tupleKeys` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | The tuples to delete |
| `$transactional` | `bool` | Whether to use transactional deletes (default: true) |
| `$confirmExists` | `bool` | Whether to check tuples exist before deletion (default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if all deleted, or Failure with error details
##### exists
```php
public function exists(
StoreInterface|string $store,
string $user,
string $relation,
string $object,
): FailureInterface|SuccessInterface
```
Check if a specific tuple exists in the store. Efficiently verifies tuple existence without retrieving all matching tuples. Useful for validation before operations or conditional logic.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L118)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------ | --------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check |
| `$user` | `string` | The user identifier |
| `$relation` | `string` | The relationship type |
| `$object` | `string` | The object identifier |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with true/false, or Failure with error details
##### getStatistics
```php
public function getStatistics(StoreInterface|string $store): FailureInterface|SuccessInterface
```
Get statistics about tuples in the store. Provides insights into the tuple distribution and counts by type and relation, useful for monitoring and capacity planning.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L134)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | -------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to analyze |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with statistics array, or Failure with error details
##### listChanges
```php
public function listChanges(
StoreInterface|string $store,
string|null $type = NULL,
DateTimeImmutable|null $startTime = NULL,
string|null $continuationToken = NULL,
int|null $pageSize = NULL,
): FailureInterface|SuccessInterface
```
List changes to tuples over time for auditing purposes. Retrieves a chronological log of tuple changes (writes and deletes) within the specified time range, useful for compliance and debugging.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L151)
###### Parameters
| Name | Type | Description |
| -------------------- | ------------------------------------------------------------ | ---------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to list changes from |
| `$type` | `string` | `null` | Filter by object type (optional) |
| `$startTime` | `DateTimeImmutable` | `null` | Start time for changes (optional) |
| `$continuationToken` | `string` | `null` | Token for pagination (optional) |
| `$pageSize` | `int` | `null` | Maximum number of changes to retrieve (default: 100) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with changes collection, or Failure with error details
##### read
```php
public function read(
StoreInterface|string $store,
TupleKeyInterface|null $tupleKey = NULL,
string|null $continuationToken = NULL,
int|null $pageSize = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Read relationship tuples with optional filtering. Retrieves tuples matching the specified criteria, with automatic pagination handling for large result sets.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L172)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------------------------------------------------- | --------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to read from |
| `$tupleKey` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | `null` | The tuple key to filter by (optional) |
| `$continuationToken` | `string` | `null` | Token for pagination (optional) |
| `$pageSize` | `int` | `null` | Maximum number of tuples to retrieve (null for all) |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Read consistency level (optional) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success with tuples collection, or Failure with error details
##### write
```php
public function write(
StoreInterface|string $store,
string $user,
string $relation,
string $object,
): FailureInterface|SuccessInterface
```
Write a single relationship tuple. Creates a relationship between a user and an object with the specified relation. This is the most common operation for establishing permissions.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L192)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------------------------------------------ | -------------------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store where the tuple will be written |
| `$user` | `string` | The user identifier (for example 'user:anne') |
| `$relation` | `string` | The relationship type (for example 'reader', 'writer') |
| `$object` | `string` | The object identifier (for example 'document:budget-2024') |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if written, or Failure with error details
##### writeBatch
```php
public function writeBatch(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
TupleKeysInterface|null $writes = NULL,
TupleKeysInterface|null $deletes = NULL,
bool $transactional = true,
int $maxParallelRequests = 1,
int $maxTuplesPerChunk = 100,
int $maxRetries = 0,
float $retryDelaySeconds = 1.0,
bool $stopOnFirstError = false,
): FailureInterface|SuccessInterface
```
Write multiple relationship tuples in a batch operation. Efficiently writes multiple tuples, with automatic chunking to respect API limits and optional duplicate filtering for performance optimization.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Services/TupleServiceInterface.php#L217)
###### Parameters
| Name | Type | Description |
| ---------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store where tuples will be written |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The tuples to write (optional) |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | The tuples to delete (optional) |
| `$transactional` | `bool` | Whether to use transactional writes (default: true) |
| `$maxParallelRequests` | `int` | Maximum parallel requests (default: 1) |
| `$maxTuplesPerChunk` | `int` | Maximum tuples per chunk (default: 100) |
| `$maxRetries` | `int` | Maximum retries (default: 0) |
| `$retryDelaySeconds` | `float` | Retry delay in seconds (default: 1.0) |
| `$stopOnFirstError` | `bool` | Whether to stop on first error (default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success if all written, or Failure with error details
<!-- End of evansims/openfga-php/docs/API/Services/TupleServiceInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Translation/README.md -->
## Translation
[API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md) > Translation
Internationalization support and message translation utilities.
**Total Components:** 3
### Interfaces
| Name | Description |
|------|-------------|
| [`TranslatorInterface`](https://github.com/evansims/openfga-php/blob/main/./TranslatorInterface.md) | Translation service interface for OpenFGA SDK messages. This interface defines the contract for a... |
### Classes
| Name | Description |
|------|-------------|
| [`Translator`](https://github.com/evansims/openfga-php/blob/main/./Translator.md) | Translation service for OpenFGA SDK messages. This implementation provides centralized message tr... |
| [`YamlParser`](https://github.com/evansims/openfga-php/blob/main/./YamlParser.md) | Simple YAML parser for translation files. This lightweight YAML parser handles the specific struc... |
---
[← Back to API Documentation](https://github.com/evansims/openfga-php/blob/main/../README.md)
<!-- End of evansims/openfga-php/docs/API/Translation/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Translation/Translator.md -->
### Translator
Translation service for OpenFGA SDK messages. This implementation provides centralized message translation with parameter substitution without external dependencies. It supports multiple locales, domain-based organization, and automatic fallback to default locale when translations are missing. The service uses a singleton pattern to maintain translation state across the application lifecycle and supports parameter substitution using %parameter% placeholder format for compatibility with existing message definitions.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`addResource()`](#addresource)
- [`getDefaultLanguage()`](#getdefaultlanguage)
- [`getDefaultLocale()`](#getdefaultlocale)
- [`has()`](#has)
- [`reset()`](#reset)
- [`setDefaultLanguage()`](#setdefaultlanguage)
- [`setDefaultLocale()`](#setdefaultlocale)
- [`trans()`](#trans)
- [`transKey()`](#transkey)
</details>
#### Namespace
`OpenFGA\Translation`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Translation/Translator.php)
#### Implements
- [`TranslatorInterface`](https://github.com/evansims/openfga-php/blob/main/TranslatorInterface.md)
#### Related Classes
- [TranslatorInterface](https://github.com/evansims/openfga-php/blob/main/Translation/TranslatorInterface.md) (interface)
#### Methods
##### addResource
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function addResource(
string $format,
string $resource,
string $locale,
string $domain = 'messages',
): void
```
Add a translation resource to the translator. Registers a translation file with the translator for a specific locale and domain. This allows the translator to load and use translations from various file formats and organize them by locale and domain for better maintainability.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L39)
###### Parameters
| Name | Type | Description |
| ----------- | -------- | ---------------------------------------------------------------------------------- |
| `$format` | `string` | The file format (for example, 'yaml', 'json', 'php') |
| `$resource` | `string` | The path to the translation file |
| `$locale` | `string` | The locale code (for example, 'en', 'es', 'fr') |
| `$domain` | `string` | The translation domain (defaults to 'messages') |
###### Returns
`void`
##### getDefaultLanguage
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function getDefaultLanguage(): Language
```
Get the current default language. Returns the Language enum representing the current default locale.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L48)
###### Returns
[`Language`](https://github.com/evansims/openfga-php/blob/main/Language.md) — The current default language
##### getDefaultLocale
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function getDefaultLocale(): string
```
Get the current default locale.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L55)
###### Returns
`string` — The current default locale code
##### has
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function has(Messages $message, string|null $locale = NULL): bool
```
Check if a translation exists for the given message. Determines whether a specific message has been translated in the given locale. This is useful for conditional messaging or fallback handling when translations may not be available for all locales.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L68)
###### Parameters
| Name | Type | Description |
| ---------- | ------------------------- | ----------------------------------------------- |
| `$message` | [`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) | The message enum case to check |
| `$locale` | `string` | `null` | Locale to check (defaults to configured locale) |
###### Returns
`bool` — True if translation exists, false otherwise
##### reset
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function reset(): void
```
Reset the translator instance. Clears the current translator instance and forces reinitialization on next use. This is particularly useful for testing scenarios where you need to start with a clean slate or when dynamically switching translation configurations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L77)
###### Returns
`void`
##### setDefaultLanguage
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function setDefaultLanguage(Language $language): void
```
Set the default language for translations. Configures the default language that is used for all translation operations when no specific language is provided. This method provides type-safe language configuration using the Language enum.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L88)
###### Parameters
| Name | Type | Description |
| ----------- | ------------------------- | ------------------------------ |
| `$language` | [`Language`](https://github.com/evansims/openfga-php/blob/main/Language.md) | The language to set as default |
###### Returns
`void`
##### setDefaultLocale
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function setDefaultLocale(string $locale): void
```
Set the default locale for translations. Configures the default locale that is used for all translation operations when no specific locale is provided. This setting affects the behavior of all translation methods and determines fallback behavior.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L101)
###### Parameters
| Name | Type | Description |
| --------- | -------- | ----------------------------------------------------------------------------- |
| `$locale` | `string` | The locale code (for example, 'en', 'es', 'fr') |
###### Returns
`void`
##### trans
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function trans(Messages $message, array<string, mixed> $parameters = [], Language|null $language = NULL): string
```
Translate a message using a Messages enum case with Language enum. Provides type-safe message translation using both the Messages and Language enums for maximum compile-time safety and better developer experience. This is the preferred method for translating SDK messages.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L115)
###### Parameters
| Name | Type | Description |
| ------------- | --------------------------------------- | ------------------------------------------------- |
| `$message` | [`Messages`](https://github.com/evansims/openfga-php/blob/main/Messages.md) | The message enum case to translate |
| `$parameters` | `array<`string`, `mixed`>` | |
| `$language` | [`Language`](https://github.com/evansims/openfga-php/blob/main/Language.md) | `null` | Language to use (defaults to configured language) |
###### Returns
`string` — The translated and parameterized message
##### transKey
*<small>Implements Translation\TranslatorInterface</small>*
```php
public function transKey(string $key, array<string, mixed> $parameters = [], string|null $locale = NULL): string
```
Translate a message using a translation key string. Provides direct translation access using string keys instead of the Messages enum. This method is useful for dynamic translations or when integrating with external translation keys that are not defined in the Messages enum.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php#L132)
###### Parameters
| Name | Type | Description |
| ------------- | -------------------------------- | --------------------------------------------- |
| `$key` | `string` | The translation key to look up |
| `$parameters` | `array<`string`, `mixed`>` | |
| `$locale` | `string` | `null` | Locale to use (defaults to configured locale) |
###### Returns
`string` — The translated and parameterized message, or the key itself if no translation found
<!-- End of evansims/openfga-php/docs/API/Translation/Translator.md -->
<!-- Source: evansims/openfga-php/docs/API/Translation/TranslatorInterface.md -->
### TranslatorInterface
Translation service interface for OpenFGA SDK messages. This interface defines the contract for a centralized message translation system that supports parameterized messages, multiple locales, and integration with the OpenFGA SDK's error handling and user-facing messaging systems. The translator is designed to work with the Messages enum for type-safe message references and supports dynamic parameter substitution for contextual error messages and user notifications.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA\Translation`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Translation/TranslatorInterface.php)
#### Related Classes
- [Translator](https://github.com/evansims/openfga-php/blob/main/Translation/Translator.md) (implementation)
<!-- End of evansims/openfga-php/docs/API/Translation/TranslatorInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Translation/YamlParser.md -->
### YamlParser
Simple YAML parser for translation files. This lightweight YAML parser handles the specific structure used by OpenFGA translation files. It supports basic key-value pairs, nested structures, and simple comments. It does not support advanced YAML features like anchors, references, or complex data types. The parser is optimized for the simple, flat-ish structure of translation files and provides better performance than a full YAML library for this specific use case.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
</details>
#### Namespace
`OpenFGA\Translation`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Translation/YamlParser.php)
<!-- End of evansims/openfga-php/docs/API/Translation/YamlParser.md -->
<!-- Source: evansims/openfga-php/docs/API/API-Index.md -->
### OpenFGA PHP SDK API Documentation
#### Complete API Reference
This documentation provides a complete reference for all classes, interfaces, and enumerations in the OpenFGA PHP SDK.
##### Quick Navigation
* **[Getting Started](https://github.com/evansims/openfga-php/blob/main/../README.md)** - Installation and basic usage
* **[Core Concepts](https://github.com/evansims/openfga-php/blob/main/../docs/README.md)** - Understanding OpenFGA and the SDK
* **[Examples](https://github.com/evansims/openfga-php/blob/main/../examples/README.md)** - Code examples and tutorials
#### API Components by Category
##### Core Client
* [`Client`](https://github.com/evansims/openfga-php/blob/main/./Client.md) - Main client implementation for all OpenFGA operations
* [`ClientInterface`](https://github.com/evansims/openfga-php/blob/main/./ClientInterface.md) - Interface definition for the client
##### Authentication & Security
* **[Authentication](https://github.com/evansims/openfga-php/blob/main/./Authentication/README.md)** - OAuth 2.0 and API key authentication
* [`ClientCredentialAuthentication`](https://github.com/evansims/openfga-php/blob/main/./Authentication/ClientCredentialAuthentication.md) - OAuth 2.0 client credentials flow
* [`TokenAuthentication`](https://github.com/evansims/openfga-php/blob/main/./Authentication/TokenAuthentication.md) - Pre-shared key authentication
##### Domain Models
* **[Models](https://github.com/evansims/openfga-php/blob/main/./Models/README.md)** - Core domain entities
* [`Store`](https://github.com/evansims/openfga-php/blob/main/./Models/Store.md) - OpenFGA store representation
* [`AuthorizationModel`](https://github.com/evansims/openfga-php/blob/main/./Models/AuthorizationModel.md) - Authorization model definition
* [`TupleKey`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleKey.md) - Relationship tuple representation
* **[Collections](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/README.md)** - Type-safe collections
* **[Enums](https://github.com/evansims/openfga-php/blob/main/./Models/Enums/README.md)** - Enumeration types
##### API Operations
* **[Requests](https://github.com/evansims/openfga-php/blob/main/./Requests/README.md)** - Request objects for API operations
* **[Responses](https://github.com/evansims/openfga-php/blob/main/./Responses/README.md)** - Response objects from API calls
##### Error Handling
* **[Results](https://github.com/evansims/openfga-php/blob/main/./Results/README.md)** - Result pattern for functional error handling
* [`Success`](https://github.com/evansims/openfga-php/blob/main/./Results/Success.md) - Successful operation result
* [`Failure`](https://github.com/evansims/openfga-php/blob/main/./Results/Failure.md) - Failed operation result
* **[Exceptions](https://github.com/evansims/openfga-php/blob/main/./Exceptions/README.md)** - Exception hierarchy for error cases
##### Infrastructure
* **[Network](https://github.com/evansims/openfga-php/blob/main/./Network/README.md)** - HTTP client and retry mechanisms
* [`RequestManager`](https://github.com/evansims/openfga-php/blob/main/./Network/RequestManager.md) - HTTP request management
* [`RetryHandler`](https://github.com/evansims/openfga-php/blob/main/./Network/RetryHandler.md) - Retry strategy implementation
* **[Observability](https://github.com/evansims/openfga-php/blob/main/./Observability/README.md)** - Telemetry and monitoring
* **[Events](https://github.com/evansims/openfga-php/blob/main/./Events/README.md)** - Event system for cross-cutting concerns
##### Advanced Features
* **[Language](https://github.com/evansims/openfga-php/blob/main/./Language.md)** - DSL parser for human-readable models
* [`Transformer`](https://github.com/evansims/openfga-php/blob/main/./Transformer.md) - DSL to API model transformer
* **[Translation](https://github.com/evansims/openfga-php/blob/main/./Translation/README.md)** - Internationalization support
* [`Messages`](https://github.com/evansims/openfga-php/blob/main/./Messages.md) - All translatable messages in the SDK
* **[Integration](https://github.com/evansims/openfga-php/blob/main/./Integration/README.md)** - Framework integration helpers
##### Validation & Schemas
* **[Schemas](https://github.com/evansims/openfga-php/blob/main/./Schemas/README.md)** - JSON schema validation system
#### Component Index
##### All Interfaces
| Interface | Namespace | Description |
| ------------------------------------------------------------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| [`AccessTokenInterface`](https://github.com/evansims/openfga-php/blob/main/./Authentication/AccessTokenInterface.md) | `Authentication` | Represents an access token for OpenFGA API authentication. Access tokens are credentials used to authenticate request... |
| [`AssertionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/AssertionInterface.md) | `Models` | Represents an assertion used to test authorization model correctness. Assertions are test cases that verify whether s... |
| [`AssertionRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./Repositories/AssertionRepositoryInterface.md) | `Repositories` | Repository interface for managing OpenFGA authorization model assertions. This interface provides data access operati... |
| [`AssertionServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/AssertionServiceInterface.md) | `Services` | Service interface for managing OpenFGA authorization model assertions. This service provides business-focused operati... |
| [`AssertionTupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/AssertionTupleKeyInterface.md) | `Models` | Defines the contract for assertion tuple keys used in authorization model testing. An assertion tuple key specifies t... |
| [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/AssertionsInterface.md) | `Models\Collections` | Collection interface for OpenFGA assertion models. This interface defines a collection that holds assertion objects u... |
| [`AuthenticationInterface`](https://github.com/evansims/openfga-php/blob/main/./Authentication/AuthenticationInterface.md) | `Authentication` | Interface for OpenFGA authentication strategies. This interface defines the contract for different authentication met... |
| [`AuthenticationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/AuthenticationServiceInterface.md) | `Services` | Service interface for managing authentication in OpenFGA operations. This service abstracts authentication concerns f... |
| [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/AuthorizationModelInterface.md) | `Models` | Represents an OpenFGA authorization model that defines permission structures. Authorization models are the core confi... |
| [`AuthorizationModelsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/AuthorizationModelsInterface.md) | `Models\Collections` | Collection interface for OpenFGA authorization model objects. This interface defines a collection that holds authoriz... |
| [`AuthorizationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/AuthorizationServiceInterface.md) | `Services` | Service interface for authorization operations. This interface defines methods for all authorization operations inclu... |
| [`BatchCheckItemInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchCheckItemInterface.md) | `Models` | Represents a single item in a batch check request. Each batch check item contains a tuple key to check, an optional c... |
| [`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/BatchCheckItemsInterface.md) | `Models\Collections` | Collection of batch check items for batch authorization requests. This collection maintains a list of BatchCheckItem ... |
| [`BatchCheckRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/BatchCheckRequestInterface.md) | `Requests` | Request for performing multiple authorization checks in a single batch. This request allows checking multiple user-ob... |
| [`BatchCheckResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/BatchCheckResponseInterface.md) | `Responses` | Response containing the results of a batch authorization check. This response contains a map of correlation IDs to ch... |
| [`BatchCheckSingleResultInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchCheckSingleResultInterface.md) | `Models` | Represents the result of a single check within a batch check response. Each result contains whether the check was all... |
| [`BatchTupleOperationInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchTupleOperationInterface.md) | `Models` | Interface for batch tuple operations. Defines the contract for organizing tuple writes and deletes into batches that ... |
| [`BatchTupleResultInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchTupleResultInterface.md) | `Models` | Interface for batch tuple operation results. Defines the contract for tracking and analyzing the results of batch tup... |
| [`CheckRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/CheckRequestInterface.md) | `Requests` | Interface for authorization check request specifications. This interface defines the contract for creating authorizat... |
| [`CheckResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/CheckResponseInterface.md) | `Responses` | Interface for permission check response objects. This interface defines the contract for responses returned when perf... |
| [`CircuitBreakerInterface`](https://github.com/evansims/openfga-php/blob/main/./Network/CircuitBreakerInterface.md) | `Network` | Circuit breaker interface for preventing cascade failures in distributed systems. This interface defines the contract... |
| [`ClientInterface`](https://github.com/evansims/openfga-php/blob/main/./ClientInterface.md) | `OpenFGA` | OpenFGA Client Interface for relationship-based access control operations. This interface defines the complete API fo... |
| [`ClientThrowable`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/ClientThrowable.md) | `Exceptions` | Base interface for all OpenFGA SDK exceptions. Extends the standard PHP Throwable interface with additional methods t... |
| [`CollectionSchemaInterface`](https://github.com/evansims/openfga-php/blob/main/./Schemas/CollectionSchemaInterface.md) | `Schemas` | Interface for collection schema definitions in the OpenFGA system. This interface extends the base SchemaInterface to... |
| [`ComputedInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/ComputedInterface.md) | `Models` | Represents a computed userset in OpenFGA authorization models. Computed usersets allow you to define relationships th... |
| [`ComputedsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/ComputedsInterface.md) | `Models\Collections` | |
| [`ConcurrentExecutorInterface`](https://github.com/evansims/openfga-php/blob/main/./Network/ConcurrentExecutorInterface.md) | `Network` | Interface for concurrent task execution. This interface defines the contract for executing multiple tasks concurrentl... |
| [`ConditionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/ConditionInterface.md) | `Models` | Represents a condition that enables dynamic authorization in OpenFGA. Conditions allow OpenFGA to make authorization ... |
| [`ConditionMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/ConditionMetadataInterface.md) | `Models` | Defines metadata information for conditions in OpenFGA authorization models. ConditionMetadata provides organizationa... |
| [`ConditionParameterInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/ConditionParameterInterface.md) | `Models` | Defines a parameter type for use in authorization conditions. ConditionParameter represents the type definition for p... |
| [`ConditionParametersInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/ConditionParametersInterface.md) | `Models\Collections` | |
| [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/ConditionsInterface.md) | `Models\Collections` | Collection interface for OpenFGA condition objects. This interface defines a collection that holds condition objects ... |
| [`ContextInterface`](https://github.com/evansims/openfga-php/blob/main/./Context/ContextInterface.md) | `Context` | Manages ambient context for OpenFGA operations. This interface provides a way to manage and access contextual informa... |
| [`CreateAuthorizationModelRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/CreateAuthorizationModelRequestInterface.md) | `Requests` | Interface for creating new authorization models in OpenFGA. This interface defines the contract for requests that cre... |
| [`CreateAuthorizationModelResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/CreateAuthorizationModelResponseInterface.md) | `Responses` | Interface for authorization model creation response objects. This interface defines the contract for responses return... |
| [`CreateStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/CreateStoreRequestInterface.md) | `Requests` | Interface for creating a new OpenFGA store. This interface defines the contract for requests that create new authoriz... |
| [`CreateStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/CreateStoreResponseInterface.md) | `Responses` | Interface for store creation response objects. This interface defines the contract for responses returned when creati... |
| [`DefaultMessagesInterface`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/DefaultMessagesInterface.md) | `Exceptions` | Interface for mapping exception error enums to their default message keys. Provides a contract for retrieving default... |
| [`DeleteStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/DeleteStoreRequestInterface.md) | `Requests` | Interface for deleting an OpenFGA store. This interface defines the contract for requests that permanently remove an ... |
| [`DeleteStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/DeleteStoreResponseInterface.md) | `Responses` | Interface for store deletion response objects. This interface defines the contract for responses returned when deleti... |
| [`DifferenceV1Interface`](https://github.com/evansims/openfga-php/blob/main/./Models/DifferenceV1Interface.md) | `Models` | Defines a difference operation between two usersets in authorization models. DifferenceV1 represents a set operation ... |
| [`EventDispatcherInterface`](https://github.com/evansims/openfga-php/blob/main/./Events/EventDispatcherInterface.md) | `Events` | Event dispatcher interface for handling domain events. The event dispatcher decouples event publishers from subscribe... |
| [`EventInterface`](https://github.com/evansims/openfga-php/blob/main/./Events/EventInterface.md) | `Events` | Base interface for all domain events. Events represent something significant that happened in the domain. They are im... |
| [`ExpandRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ExpandRequestInterface.md) | `Requests` | Interface for expanding relationship graphs in OpenFGA. This interface defines the contract for requests that expand ... |
| [`ExpandResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ExpandResponseInterface.md) | `Responses` | Interface for relationship expansion response objects. This interface defines the contract for responses returned whe... |
| [`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/./Results/FailureInterface.md) | `Results` | Represents a failed result containing an error. Failure results indicate that an operation encountered an error and c... |
| [`GetAuthorizationModelRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/GetAuthorizationModelRequestInterface.md) | `Requests` | Interface for retrieving a specific authorization model. This interface defines the contract for requests that fetch ... |
| [`GetAuthorizationModelResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/GetAuthorizationModelResponseInterface.md) | `Responses` | Interface for authorization model retrieval response objects. This interface defines the contract for responses retur... |
| [`GetStoreRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/GetStoreRequestInterface.md) | `Requests` | Interface for retrieving information about an OpenFGA store. This interface defines the contract for requests that fe... |
| [`GetStoreResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/GetStoreResponseInterface.md) | `Responses` | Interface for store retrieval response objects. This interface defines the contract for responses returned when retri... |
| [`HttpClientInterface`](https://github.com/evansims/openfga-php/blob/main/./Network/HttpClientInterface.md) | `Network` | HTTP client interface for sending HTTP requests. This interface abstracts the HTTP client implementation, allowing di... |
| [`HttpServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/HttpServiceInterface.md) | `Services` | Service for handling HTTP communication. This service abstracts HTTP operations from the Client class, providing a cl... |
| [`IndexedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/IndexedCollectionInterface.md) | `Models\Collections` | Represents a type-safe collection indexed by integers, similar to a JSON array. This interface provides a type-safe, ... |
| [`KeyedCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/KeyedCollectionInterface.md) | `Models\Collections` | Represents a collection that is indexed by a string, like a JSON object. |
| [`LeafInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/LeafInterface.md) | `Models` | Represents a leaf node in OpenFGA's userset tree structure. Leaf nodes are terminal nodes in the authorization evalua... |
| [`ListAuthorizationModelsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListAuthorizationModelsRequestInterface.md) | `Requests` | Interface for listing authorization models in a store. This interface defines the contract for requests that retrieve... |
| [`ListAuthorizationModelsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListAuthorizationModelsResponseInterface.md) | `Responses` | Interface for authorization models listing response objects. This interface defines the contract for responses return... |
| [`ListObjectsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListObjectsRequestInterface.md) | `Requests` | Interface for listing objects that a user has access to. This interface defines the contract for requests that query ... |
| [`ListObjectsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListObjectsResponseInterface.md) | `Responses` | Interface for object listing response objects. This interface defines the contract for responses returned when listin... |
| [`ListStoresRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListStoresRequestInterface.md) | `Requests` | Interface for listing available OpenFGA stores. This interface defines the contract for requests that retrieve a pagi... |
| [`ListStoresResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListStoresResponseInterface.md) | `Responses` | Interface for stores listing response objects. This interface defines the contract for responses returned when listin... |
| [`ListTupleChangesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListTupleChangesRequestInterface.md) | `Requests` | Interface for listing historical changes to relationship tuples. This interface defines the contract for requests tha... |
| [`ListTupleChangesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListTupleChangesResponseInterface.md) | `Responses` | Interface for tuple changes listing response objects. This interface defines the contract for responses returned when... |
| [`ListUsersRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListUsersRequestInterface.md) | `Requests` | Interface for listing users who have a specific relation to an object. This interface defines the contract for reques... |
| [`ListUsersResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListUsersResponseInterface.md) | `Responses` | Interface for user listing response objects. This interface defines the contract for responses returned when listing ... |
| [`MetadataInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/MetadataInterface.md) | `Models` | Represents metadata associated with OpenFGA authorization model components. Metadata provides additional context and ... |
| [`ModelInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/ModelInterface.md) | `Models` | Base interface for all OpenFGA model objects. This interface establishes the foundation for all domain models in the ... |
| [`ModelRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./Repositories/ModelRepositoryInterface.md) | `Repositories` | Repository contract for authorization model operations. This interface defines the contract for managing authorizatio... |
| [`ModelServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/ModelServiceInterface.md) | `Services` | Service interface for managing OpenFGA authorization models. This service provides business-focused operations for wo... |
| [`NodeInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/NodeInterface.md) | `Models` | Represents a node in a userset tree structure. Nodes are fundamental building blocks in OpenFGA's authorization model... |
| [`NodeUnionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/NodeUnionInterface.md) | `Models` | Represents a union operation between multiple nodes in a userset tree. A node union combines multiple authorization n... |
| [`NodesInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/NodesInterface.md) | `Models\Collections` | |
| [`ObjectRelationInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/ObjectRelationInterface.md) | `Models` | Represents an object-relation pair in OpenFGA authorization models. Object-relation pairs are fundamental components ... |
| [`ReadAssertionsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ReadAssertionsRequestInterface.md) | `Requests` | Interface for reading test assertions from an authorization model. This interface defines the contract for requests t... |
| [`ReadAssertionsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ReadAssertionsResponseInterface.md) | `Responses` | Interface for assertions reading response objects. This interface defines the contract for responses returned when re... |
| [`ReadTuplesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/ReadTuplesRequestInterface.md) | `Requests` | Interface for reading relationship tuples from an OpenFGA store. This interface defines the contract for requests tha... |
| [`ReadTuplesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ReadTuplesResponseInterface.md) | `Responses` | Interface for tuple reading response objects. This interface defines the contract for responses returned when reading... |
| [`RelationMetadataCollectionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/RelationMetadataCollectionInterface.md) | `Models\Collections` | Collection interface for OpenFGA relation metadata objects. This interface defines a keyed collection that holds rela... |
| [`RelationMetadataInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/RelationMetadataInterface.md) | `Models` | Represents metadata associated with a relation in OpenFGA authorization models. Relation metadata provides additional... |
| [`RelationReferenceInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/RelationReferenceInterface.md) | `Models` | Defines the contract for relation references with optional conditions. A relation reference specifies a particular re... |
| [`RelationReferencesInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/RelationReferencesInterface.md) | `Models\Collections` | |
| [`RequestContextInterface`](https://github.com/evansims/openfga-php/blob/main/./Network/RequestContextInterface.md) | `Network` | Represents the context for an HTTP request to the OpenFGA API. This interface encapsulates all the essential componen... |
| [`RequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/RequestInterface.md) | `Requests` | Base interface for all OpenFGA API request objects. This interface defines the core contract that all OpenFGA API req... |
| [`RequestManagerInterface`](https://github.com/evansims/openfga-php/blob/main/./Network/RequestManagerInterface.md) | `Network` | Manages HTTP requests and responses for OpenFGA API communication. This interface defines the core HTTP communication... |
| [`ResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/ResponseInterface.md) | `Responses` | Base interface for all OpenFGA API response objects. This interface establishes the foundational contract for all res... |
| [`ResultInterface`](https://github.com/evansims/openfga-php/blob/main/./Results/ResultInterface.md) | `Results` | Represents the result of an operation that can either succeed or fail. The Result pattern provides a safe and composa... |
| [`RetryHandlerInterface`](https://github.com/evansims/openfga-php/blob/main/./Network/RetryHandlerInterface.md) | `Network` | Retry handler interface for advanced HTTP request retry strategies. This interface defines the contract for retry han... |
| [`RetryStrategyInterface`](https://github.com/evansims/openfga-php/blob/main/./Network/RetryStrategyInterface.md) | `Network` | Interface for implementing retry strategies. This interface defines the contract for different retry strategies that ... |
| [`SchemaBuilderInterface`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaBuilderInterface.md) | `Schemas` | Interface for building schema definitions using the builder pattern. This interface provides a fluent API for constru... |
| [`SchemaInterface`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaInterface.md) | `Schemas` | Base interface for schema definitions in the OpenFGA system. This interface defines the fundamental contract for all ... |
| [`SchemaPropertyInterface`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaPropertyInterface.md) | `Schemas` | Interface for schema property definitions. This interface defines the contract for schema property objects that speci... |
| [`SchemaRegistryInterface`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaRegistryInterface.md) | `Schemas` | Registry for managing schema definitions in the OpenFGA system. This interface provides a centralized storage and ret... |
| [`SchemaValidatorInterface`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaValidatorInterface.md) | `Schemas` | Interface for schema validation and object transformation in the OpenFGA system. This interface defines the contract ... |
| [`SourceInfoInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/SourceInfoInterface.md) | `Models` | Represents source file information for OpenFGA model elements. Source information provides debugging and development ... |
| [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/StoreInterface.md) | `Models` | Represents an OpenFGA store that contains authorization models and relationship tuples. A store is a logical containe... |
| [`StoreRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./Repositories/StoreRepositoryInterface.md) | `Repositories` | Repository interface for store operations. This interface defines the contract for store repository implementations, ... |
| [`StoreServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/StoreServiceInterface.md) | `Services` | Service interface for high-level store operations. This interface provides a business-focused abstraction over store ... |
| [`StoresInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/StoresInterface.md) | `Models\Collections` | Collection interface for OpenFGA store objects. This interface defines a collection that holds store objects represen... |
| [`StreamedListObjectsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/StreamedListObjectsRequestInterface.md) | `Requests` | Request interface for streaming objects that a user has a specific relationship with. This request finds all objects ... |
| [`StreamedListObjectsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/StreamedListObjectsResponseInterface.md) | `Responses` | Response interface for streaming objects that a user has a specific relationship with. This response provides a Gener... |
| [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/./Results/SuccessInterface.md) | `Results` | Represents a successful result containing a value. Success results indicate that an operation completed successfully ... |
| [`TelemetryEventListenerInterface`](https://github.com/evansims/openfga-php/blob/main/./Observability/TelemetryEventListenerInterface.md) | `Observability` | Interface for event listeners that forward domain events to telemetry providers. This interface defines the contract ... |
| [`TelemetryInterface`](https://github.com/evansims/openfga-php/blob/main/./Observability/TelemetryInterface.md) | `Observability` | Interface for OpenTelemetry integration in the OpenFGA SDK. This interface provides methods for instrumenting OpenFGA... |
| [`TelemetryServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/TelemetryServiceInterface.md) | `Services` | Service interface for managing telemetry and observability in OpenFGA operations. This service provides a higher-leve... |
| [`TransformerInterface`](https://github.com/evansims/openfga-php/blob/main/./TransformerInterface.md) | `OpenFGA` | OpenFGA DSL Transformer Interface for authorization model conversions. This interface defines methods for converting ... |
| [`TranslatorInterface`](https://github.com/evansims/openfga-php/blob/main/./Translation/TranslatorInterface.md) | `Translation` | Translation service interface for OpenFGA SDK messages. This interface defines the contract for a centralized message... |
| [`TupleChangeInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleChangeInterface.md) | `Models` | Represents a change event for a relationship tuple in OpenFGA. Tuple changes capture the history of relationship modi... |
| [`TupleChangesInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TupleChangesInterface.md) | `Models\Collections` | |
| [`TupleFilterServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/TupleFilterServiceInterface.md) | `Services` | Service for filtering and deduplicating tuple operations. This service encapsulates the business logic for handling d... |
| [`TupleInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleInterface.md) | `Models` | Represents a relationship tuple in the OpenFGA authorization system. Tuples are the fundamental building blocks of Op... |
| [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleKeyInterface.md) | `Models` | Represents a tuple key that defines the components of a relationship in OpenFGA. Tuple keys are the core data structu... |
| [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TupleKeysInterface.md) | `Models\Collections` | A collection of relationship tuple keys. This interface represents a type-safe collection of tuple keys that define r... |
| [`TupleRepositoryInterface`](https://github.com/evansims/openfga-php/blob/main/./Repositories/TupleRepositoryInterface.md) | `Repositories` | Repository contract for relationship tuple operations. This interface defines the contract for managing relationship ... |
| [`TupleServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Services/TupleServiceInterface.md) | `Services` | Service interface for managing OpenFGA relationship tuples. This service provides business-focused operations for wor... |
| [`TupleToUsersetV1Interface`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleToUsersetV1Interface.md) | `Models` | Defines a tuple-to-userset operation in authorization models. TupleToUsersetV1 represents an authorization operation ... |
| [`TuplesInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TuplesInterface.md) | `Models\Collections` | Collection interface for OpenFGA tuple objects. This interface defines a collection that holds tuple objects represen... |
| [`TypeDefinitionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/TypeDefinitionInterface.md) | `Models` | Represents a type definition in an OpenFGA authorization model. Type definitions are the building blocks of authoriza... |
| [`TypeDefinitionRelationsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TypeDefinitionRelationsInterface.md) | `Models\Collections` | |
| [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TypeDefinitionsInterface.md) | `Models\Collections` | Collection interface for OpenFGA type definition objects. This interface defines a collection that holds type definit... |
| [`TypedWildcardInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/TypedWildcardInterface.md) | `Models` | Defines the contract for typed wildcard specifications. A typed wildcard represents "all users of a specific type" in... |
| [`UserInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UserInterface.md) | `Models` | Represents a user in an OpenFGA authorization model. In OpenFGA, users are flexible entities that can represent vario... |
| [`UserObjectInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UserObjectInterface.md) | `Models` | Represents a user object in OpenFGA authorization model. User objects are typed entities that can be subjects in auth... |
| [`UserTypeFilterInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UserTypeFilterInterface.md) | `Models` | Represents a filter for limiting users by their relationships to specific object types. User type filters are used in... |
| [`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UserTypeFiltersInterface.md) | `Models\Collections` | |
| [`UsersInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UsersInterface.md) | `Models\Collections` | Represents a collection of users in authorization contexts. This collection manages users who have been granted acces... |
| [`UsersListInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UsersListInterface.md) | `Models\Collections` | |
| [`UsersListUserInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersListUserInterface.md) | `Models` | Represents a user in a list context for authorization operations. UsersListUser provides a simple wrapper around user... |
| [`UsersetInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetInterface.md) | `Models` | Defines the contract for userset specifications in authorization models. A userset represents a collection of users t... |
| [`UsersetTreeDifferenceInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetTreeDifferenceInterface.md) | `Models` | Defines a difference operation node in authorization evaluation trees. UsersetTreeDifference represents a node in the... |
| [`UsersetTreeInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetTreeInterface.md) | `Models` | Defines a tree structure for representing complex userset operations. UsersetTree provides a hierarchical representat... |
| [`UsersetTreeTupleToUsersetInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetTreeTupleToUsersetInterface.md) | `Models` | Defines a tuple-to-userset operation node in authorization evaluation trees. UsersetTreeTupleToUserset represents a n... |
| [`UsersetUnionInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UsersetUnionInterface.md) | `Models\Collections` | Represents a specialized collection for userset union operations. This collection is specifically designed for managi... |
| [`UsersetUserInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetUserInterface.md) | `Models` | Defines the contract for userset user specifications. A userset user represents a reference to users through a userse... |
| [`UsersetsInterface`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UsersetsInterface.md) | `Models\Collections` | Represents a collection of usersets used in authorization model operations. This collection manages multiple userset ... |
| [`ValidationServiceInterface`](https://github.com/evansims/openfga-php/blob/main/./Schemas/ValidationServiceInterface.md) | `Schemas` | Service for validating data against schemas. This service encapsulates the validation logic, separating it from objec... |
| [`WriteAssertionsRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/WriteAssertionsRequestInterface.md) | `Requests` | Interface for writing test assertions to an authorization model. This interface defines the contract for requests tha... |
| [`WriteAssertionsResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/WriteAssertionsResponseInterface.md) | `Responses` | Interface for assertions writing response objects. This interface defines the contract for responses returned when wr... |
| [`WriteTuplesRequestInterface`](https://github.com/evansims/openfga-php/blob/main/./Requests/WriteTuplesRequestInterface.md) | `Requests` | Interface for writing relationship tuples to an OpenFGA store. This interface defines the contract for requests that ... |
| [`WriteTuplesResponseInterface`](https://github.com/evansims/openfga-php/blob/main/./Responses/WriteTuplesResponseInterface.md) | `Responses` | Interface for tuple writing response objects. This interface defines the contract for responses returned when writing... |
##### All Classes
| Class | Namespace | Description |
| -------------------------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| [`AccessToken`](https://github.com/evansims/openfga-php/blob/main/./Authentication/AccessToken.md) | `Authentication` | Immutable access token implementation for OpenFGA API authentication. This class represents an OAuth 2.0 access token... |
| [`Assertion`](https://github.com/evansims/openfga-php/blob/main/./Models/Assertion.md) | `Models` | Tests whether your authorization model behaves correctly for specific scenarios. Assertions are test cases that verif... |
| [`AssertionService`](https://github.com/evansims/openfga-php/blob/main/./Services/AssertionService.md) | `Services` | Service implementation for managing OpenFGA authorization model assertions. Provides business-focused operations for ... |
| [`AssertionTupleKey`](https://github.com/evansims/openfga-php/blob/main/./Models/AssertionTupleKey.md) | `Models` | Represents a tuple key used for testing authorization model assertions. An AssertionTupleKey defines the specific use... |
| [`Assertions`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Assertions.md) | `Models\Collections` | Collection implementation for OpenFGA assertion models. |
| [`AuthenticationException`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/AuthenticationException.md) | `Exceptions` | Authentication-related exception for the OpenFGA SDK. Thrown when authentication failures occur, such as expired or i... |
| [`AuthenticationService`](https://github.com/evansims/openfga-php/blob/main/./Services/AuthenticationService.md) | `Services` | Service implementation for managing authentication in OpenFGA operations. This service encapsulates all authenticatio... |
| [`AuthorizationModel`](https://github.com/evansims/openfga-php/blob/main/./Models/AuthorizationModel.md) | `Models` | Defines the authorization rules and relationships for your application. An AuthorizationModel is the core configurati... |
| [`AuthorizationModels`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/AuthorizationModels.md) | `Models\Collections` | Collection implementation for OpenFGA authorization model objects. This class provides a concrete implementation for ... |
| [`AuthorizationService`](https://github.com/evansims/openfga-php/blob/main/./Services/AuthorizationService.md) | `Services` | Service implementation for authorization operations. This service handles all authorization-related queries including... |
| [`BatchCheckItem`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchCheckItem.md) | `Models` | Represents a single item in a batch check request. Each batch check item contains a tuple key to check, an optional c... |
| [`BatchCheckItems`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/BatchCheckItems.md) | `Models\Collections` | Collection of batch check items for batch authorization requests. This collection maintains a list of BatchCheckItem ... |
| [`BatchCheckRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/BatchCheckRequest.md) | `Requests` | Request for performing multiple authorization checks in a single batch. This request allows checking multiple user-ob... |
| [`BatchCheckResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/BatchCheckResponse.md) | `Responses` | Response containing the results of a batch authorization check. This response contains a map of correlation IDs to ch... |
| [`BatchCheckSingleResult`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchCheckSingleResult.md) | `Models` | Represents the result of a single check within a batch check response. Each result contains whether the check was all... |
| [`BatchRequestProcessor`](https://github.com/evansims/openfga-php/blob/main/./Network/BatchRequestProcessor.md) | `Network` | Handles batch processing of write tuple requests. This class encapsulates the logic for processing write tuple reques... |
| [`BatchTupleOperation`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchTupleOperation.md) | `Models` | Represents a batch tuple operation containing both writes and deletes. This model organizes tuple operations for batc... |
| [`BatchTupleResult`](https://github.com/evansims/openfga-php/blob/main/./Models/BatchTupleResult.md) | `Models` | Represents the result of a batch tuple operation. This model tracks the results of processing a batch of tuple operat... |
| [`CheckRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/CheckRequest.md) | `Requests` | Request for performing authorization checks in OpenFGA. This request determines whether a user has a specific relatio... |
| [`CheckResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/CheckResponse.md) | `Responses` | Response containing the result of an authorization check. This response indicates whether a user has a specific relat... |
| [`CircuitBreaker`](https://github.com/evansims/openfga-php/blob/main/./Network/CircuitBreaker.md) | `Network` | Circuit breaker implementation for preventing cascade failures in distributed systems. This class implements the circ... |
| [`Client`](https://github.com/evansims/openfga-php/blob/main/./Client.md) | `OpenFGA` | OpenFGA Client implementation for relationship-based access control operations. This client provides a complete imple... |
| [`ClientCredentialAuthentication`](https://github.com/evansims/openfga-php/blob/main/./Authentication/ClientCredentialAuthentication.md) | `Authentication` | OAuth 2.0 Client Credentials authentication strategy for OpenFGA client. This authentication strategy implements the ... |
| [`ClientException`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/ClientException.md) | `Exceptions` | General client exception for the OpenFGA SDK. Thrown for high-level client errors that can be categorized into differ... |
| [`CollectionSchema`](https://github.com/evansims/openfga-php/blob/main/./Schemas/CollectionSchema.md) | `Schemas` | Schema definition specifically for validating and transforming collection data structures. This specialized schema ha... |
| [`Computed`](https://github.com/evansims/openfga-php/blob/main/./Models/Computed.md) | `Models` | Represents a computed userset reference in authorization evaluation trees. A Computed defines a userset that is calcu... |
| [`Computeds`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Computeds.md) | `Models\Collections` | |
| [`Condition`](https://github.com/evansims/openfga-php/blob/main/./Models/Condition.md) | `Models` | Represents an ABAC (Attribute-Based Access Control) condition in your authorization model. A Condition defines a logi... |
| [`ConditionMetadata`](https://github.com/evansims/openfga-php/blob/main/./Models/ConditionMetadata.md) | `Models` | Contains metadata information about conditions in your authorization model. ConditionMetadata provides context about ... |
| [`ConditionParameter`](https://github.com/evansims/openfga-php/blob/main/./Models/ConditionParameter.md) | `Models` | Represents a parameter type definition for ABAC conditions. ConditionParameter defines the type structure for paramet... |
| [`ConditionParameters`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/ConditionParameters.md) | `Models\Collections` | |
| [`Conditions`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Conditions.md) | `Models\Collections` | Collection implementation for OpenFGA condition objects. This class provides a concrete implementation for managing c... |
| [`ConfigurationException`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/ConfigurationException.md) | `Exceptions` | Configuration-related exception for the OpenFGA SDK. Thrown when configuration errors occur, typically related to mis... |
| [`Context`](https://github.com/evansims/openfga-php/blob/main/./Context/Context.md) | `Context` | Ambient Context Manager. Provides Python-style context management for PHP, allowing functions to access shared contex... |
| [`CreateAuthorizationModelRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/CreateAuthorizationModelRequest.md) | `Requests` | Request for creating a new authorization model in OpenFGA. Authorization models define the permission structure for y... |
| [`CreateAuthorizationModelResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/CreateAuthorizationModelResponse.md) | `Responses` | Response confirming successful creation of a new authorization model. This response provides the unique identifier of... |
| [`CreateStoreRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/CreateStoreRequest.md) | `Requests` | Request for creating a new OpenFGA store. Stores provide data isolation for different applications or environments, m... |
| [`CreateStoreResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/CreateStoreResponse.md) | `Responses` | Response confirming successful creation of a new store. This response provides the details of the newly created autho... |
| [`DefaultMessages`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/DefaultMessages.md) | `Exceptions` | Maps exception error enums to their default message keys. This class provides the concrete implementation for mapping... |
| [`DeleteStoreRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/DeleteStoreRequest.md) | `Requests` | Request for permanently deleting a store and all its data. This request removes the entire store, including all autho... |
| [`DeleteStoreResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/DeleteStoreResponse.md) | `Responses` | Response confirming successful deletion of a store. This response is returned when a store has been successfully dele... |
| [`DifferenceV1`](https://github.com/evansims/openfga-php/blob/main/./Models/DifferenceV1.md) | `Models` | Represents a set difference operation between two usersets. In authorization models, you sometimes need to grant acce... |
| [`EventAwareTelemetryService`](https://github.com/evansims/openfga-php/blob/main/./Services/EventAwareTelemetryService.md) | `Services` | Event-aware telemetry service that emits domain events. This service extends the base TelemetryService functionality ... |
| [`EventDispatcher`](https://github.com/evansims/openfga-php/blob/main/./Events/EventDispatcher.md) | `Events` | Simple event dispatcher implementation. Manages event listeners and dispatches events to registered handlers. Support... |
| [`ExpandRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ExpandRequest.md) | `Requests` | Request for expanding a relationship to show all users who have that relationship. This request returns the complete ... |
| [`ExpandResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ExpandResponse.md) | `Responses` | Response containing the expanded userset tree for a relationship query. This response provides a hierarchical tree st... |
| [`ExponentialBackoffRetryStrategy`](https://github.com/evansims/openfga-php/blob/main/./Network/ExponentialBackoffRetryStrategy.md) | `Network` | Exponential backoff retry strategy implementation. This strategy implements exponential backoff with jitter for retry... |
| [`Failure`](https://github.com/evansims/openfga-php/blob/main/./Results/Failure.md) | `Results` | Concrete implementation of a failed result containing an error. This class represents the failed outcome of an operat... |
| [`FiberConcurrentExecutor`](https://github.com/evansims/openfga-php/blob/main/./Network/FiberConcurrentExecutor.md) | `Network` | Fiber-based concurrent executor implementation. This implementation uses PHP 8.1+ Fibers to execute tasks concurrentl... |
| [`GetAuthorizationModelRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/GetAuthorizationModelRequest.md) | `Requests` | Request for retrieving a specific authorization model by its ID. This request fetches the complete definition of an a... |
| [`GetAuthorizationModelResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/GetAuthorizationModelResponse.md) | `Responses` | Response containing a specific authorization model from the store. This response provides the complete authorization ... |
| [`GetStoreRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/GetStoreRequest.md) | `Requests` | Request for retrieving store information by its ID. This request fetches the details of a specific store, including i... |
| [`GetStoreResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/GetStoreResponse.md) | `Responses` | Response containing detailed information about a specific store. This response provides comprehensive store metadata ... |
| [`HttpAssertionRepository`](https://github.com/evansims/openfga-php/blob/main/./Repositories/HttpAssertionRepository.md) | `Repositories` | HTTP implementation of assertion repository for OpenFGA API communication. This repository handles assertion operatio... |
| [`HttpModelRepository`](https://github.com/evansims/openfga-php/blob/main/./Repositories/HttpModelRepository.md) | `Repositories` | HTTP implementation of the model repository. This repository handles authorization model operations via HTTP requests... |
| [`HttpRequestSentEvent`](https://github.com/evansims/openfga-php/blob/main/./Events/HttpRequestSentEvent.md) | `Events` | Event fired when an HTTP request is sent to the OpenFGA API. This event contains the outgoing request details for tel... |
| [`HttpResponseReceivedEvent`](https://github.com/evansims/openfga-php/blob/main/./Events/HttpResponseReceivedEvent.md) | `Events` | Event fired when an HTTP response is received from the OpenFGA API. This event contains both the request and response... |
| [`HttpService`](https://github.com/evansims/openfga-php/blob/main/./Services/HttpService.md) | `Services` | Default implementation of HttpServiceInterface. This implementation delegates to RequestManager for actual HTTP opera... |
| [`HttpStoreRepository`](https://github.com/evansims/openfga-php/blob/main/./Repositories/HttpStoreRepository.md) | `Repositories` | HTTP implementation of the store repository. This repository provides a domain-focused abstraction for store operatio... |
| [`HttpTupleRepository`](https://github.com/evansims/openfga-php/blob/main/./Repositories/HttpTupleRepository.md) | `Repositories` | HTTP implementation of the tuple repository. This repository handles tuple operations via HTTP requests to the OpenFG... |
| [`Leaf`](https://github.com/evansims/openfga-php/blob/main/./Models/Leaf.md) | `Models` | Represents a leaf node in authorization evaluation trees containing specific users. A Leaf is a terminal node in the ... |
| [`ListAuthorizationModelsRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListAuthorizationModelsRequest.md) | `Requests` | Request for listing all authorization models in a store. This request retrieves a paginated list of authorization mod... |
| [`ListAuthorizationModelsResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListAuthorizationModelsResponse.md) | `Responses` | Response containing a paginated list of authorization models. This response provides access to authorization models w... |
| [`ListObjectsRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListObjectsRequest.md) | `Requests` | Request for listing objects that a user has a specific relationship with. This request finds all objects of a given t... |
| [`ListObjectsResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListObjectsResponse.md) | `Responses` | Response containing a list of objects that a user has a specific relationship with. This response provides an array o... |
| [`ListStoresRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListStoresRequest.md) | `Requests` | Request for listing all available stores with pagination support. This request retrieves a paginated list of stores a... |
| [`ListStoresResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListStoresResponse.md) | `Responses` | Response containing a paginated list of available stores. This response provides access to stores that the authentica... |
| [`ListTupleChangesRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListTupleChangesRequest.md) | `Requests` | Request for listing changes to relationship tuples over time. This request retrieves a chronological list of tuple mo... |
| [`ListTupleChangesResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListTupleChangesResponse.md) | `Responses` | Response containing a paginated list of tuple changes from the store. This response provides a collection of tuple ch... |
| [`ListUsersRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ListUsersRequest.md) | `Requests` | Request for listing users who have a specific relationship with an object. This request finds all users (or usersets)... |
| [`ListUsersResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ListUsersResponse.md) | `Responses` | Response containing a list of users that have a specific relationship with an object. This response provides a collec... |
| [`Metadata`](https://github.com/evansims/openfga-php/blob/main/./Models/Metadata.md) | `Models` | Contains metadata information about type definitions in your authorization model. Metadata provides additional contex... |
| [`ModelService`](https://github.com/evansims/openfga-php/blob/main/./Services/ModelService.md) | `Services` | Service implementation for managing OpenFGA authorization models. Provides business-focused operations for working wi... |
| [`NetworkException`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/NetworkException.md) | `Exceptions` | Network-related exception for the OpenFGA SDK. Thrown when network or HTTP communication errors occur while interacti... |
| [`Node`](https://github.com/evansims/openfga-php/blob/main/./Models/Node.md) | `Models` | Represents a node in the authorization evaluation tree structure. When OpenFGA evaluates complex authorization rules,... |
| [`NodeUnion`](https://github.com/evansims/openfga-php/blob/main/./Models/NodeUnion.md) | `Models` | Represents a union of multiple nodes in an authorization model tree. When OpenFGA evaluates complex authorization rul... |
| [`Nodes`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Nodes.md) | `Models\Collections` | |
| [`ObjectRelation`](https://github.com/evansims/openfga-php/blob/main/./Models/ObjectRelation.md) | `Models` | Represents a reference to a specific relation on an object. In authorization models, you often need to reference rela... |
| [`OpenTelemetryProvider`](https://github.com/evansims/openfga-php/blob/main/./Observability/OpenTelemetryProvider.md) | `Observability` | OpenTelemetry implementation for OpenFGA SDK observability. This class provides comprehensive telemetry capabilities ... |
| [`OperationCompletedEvent`](https://github.com/evansims/openfga-php/blob/main/./Events/OperationCompletedEvent.md) | `Events` | Event fired when a high-level operation completes. This event tracks the completion of business operations with succe... |
| [`OperationStartedEvent`](https://github.com/evansims/openfga-php/blob/main/./Events/OperationStartedEvent.md) | `Events` | Event fired when a high-level operation starts. This event tracks business operations like check, expand, writeTuples... |
| [`ParallelTaskExecutor`](https://github.com/evansims/openfga-php/blob/main/./Network/ParallelTaskExecutor.md) | `Network` | Executes tasks in parallel using the RequestManager infrastructure. This class provides a clean abstraction for paral... |
| [`PsrHttpClient`](https://github.com/evansims/openfga-php/blob/main/./Network/PsrHttpClient.md) | `Network` | PSR-18 compliant HTTP client implementation. This implementation wraps any PSR-18 compatible HTTP client, providing a... |
| [`ReadAssertionsRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ReadAssertionsRequest.md) | `Requests` | Request for reading test assertions associated with an authorization model. This request retrieves the test assertion... |
| [`ReadAssertionsResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ReadAssertionsResponse.md) | `Responses` | Response containing test assertions associated with an authorization model. This response provides access to test ass... |
| [`ReadTuplesRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/ReadTuplesRequest.md) | `Requests` | Request for reading relationship tuples that match specified criteria. This request retrieves tuples from a store bas... |
| [`ReadTuplesResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/ReadTuplesResponse.md) | `Responses` | Response containing a paginated list of relationship tuples. This response provides access to relationship tuples tha... |
| [`RelationMetadata`](https://github.com/evansims/openfga-php/blob/main/./Models/RelationMetadata.md) | `Models` | Contains metadata information about a relation in your authorization model. RelationMetadata provides additional cont... |
| [`RelationMetadataCollection`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/RelationMetadataCollection.md) | `Models\Collections` | Collection implementation for OpenFGA relation metadata objects. This class provides a concrete implementation for ma... |
| [`RelationReference`](https://github.com/evansims/openfga-php/blob/main/./Models/RelationReference.md) | `Models` | Represents a reference to a specific relation with optional conditions. A RelationReference identifies a relation wit... |
| [`RelationReferences`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/RelationReferences.md) | `Models\Collections` | |
| [`RequestContext`](https://github.com/evansims/openfga-php/blob/main/./Network/RequestContext.md) | `Network` | Implementation of request context for OpenFGA API operations. This class provides a concrete implementation of the Re... |
| [`RequestManager`](https://github.com/evansims/openfga-php/blob/main/./Network/RequestManager.md) | `Network` | Concrete implementation of HTTP request management for OpenFGA API communication. This class provides the core HTTP c... |
| [`RequestManagerFactory`](https://github.com/evansims/openfga-php/blob/main/./Network/RequestManagerFactory.md) | `Network` | Factory for creating RequestManager instances. This factory encapsulates the creation of RequestManager instances wit... |
| [`RetryHandler`](https://github.com/evansims/openfga-php/blob/main/./Network/RetryHandler.md) | `Network` | Concrete implementation of the retry handler using standard sleep delays. This final class provides the default imple... |
| [`Schema`](https://github.com/evansims/openfga-php/blob/main/./Schemas/Schema.md) | `Schemas` | JSON schema definition for validating and transforming data structures. This schema defines validation rules and tran... |
| [`SchemaBuilder`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaBuilder.md) | `Schemas` | Fluent builder for creating JSON schemas for data validation and transformation. This builder provides a fluent API f... |
| [`SchemaProperty`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaProperty.md) | `Schemas` | Represents a single property definition within a schema. This class defines the validation rules, type information, a... |
| [`SchemaRegistry`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaRegistry.md) | `Schemas` | Centralized registry for managing schema definitions across the OpenFGA system. This registry provides a static, glob... |
| [`SchemaValidator`](https://github.com/evansims/openfga-php/blob/main/./Schemas/SchemaValidator.md) | `Schemas` | Validates and transforms data according to registered JSON schemas. This validator ensures that API response data con... |
| [`SerializationException`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/SerializationException.md) | `Exceptions` | Serialization-related exception for the OpenFGA SDK. Thrown when data serialization, deserialization, or validation e... |
| [`ServiceProvider`](https://github.com/evansims/openfga-php/blob/main/./Integration/ServiceProvider.md) | `Integration` | Service provider for automatic dependency injection container registration. This class enables automatic registration... |
| [`SimpleConcurrentExecutor`](https://github.com/evansims/openfga-php/blob/main/./Network/SimpleConcurrentExecutor.md) | `Network` | Simple concurrent executor implementation. This implementation provides a fallback for environments without Fiber sup... |
| [`SourceInfo`](https://github.com/evansims/openfga-php/blob/main/./Models/SourceInfo.md) | `Models` | Represents source file information for debugging and development tools. SourceInfo provides metadata about where elem... |
| [`Store`](https://github.com/evansims/openfga-php/blob/main/./Models/Store.md) | `Models` | Represents an OpenFGA authorization store that contains your permission data. A Store is a container for all your aut... |
| [`StoreService`](https://github.com/evansims/openfga-php/blob/main/./Services/StoreService.md) | `Services` | Service implementation for high-level store operations. This service provides business-focused abstractions over the ... |
| [`Stores`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Stores.md) | `Models\Collections` | Collection implementation for OpenFGA store objects. This class provides a concrete implementation for managing colle... |
| [`StreamedListObjectsRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/StreamedListObjectsRequest.md) | `Requests` | Request for streaming objects that a user has a specific relationship with. This request finds all objects of a given... |
| [`StreamedListObjectsResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/StreamedListObjectsResponse.md) | `Responses` | Response containing streaming objects that a user has a specific relationship with. This response processes a streami... |
| [`Success`](https://github.com/evansims/openfga-php/blob/main/./Results/Success.md) | `Results` | Concrete implementation of a successful result containing a value. This class represents the successful outcome of an... |
| [`TelemetryEventListener`](https://github.com/evansims/openfga-php/blob/main/./Observability/TelemetryEventListener.md) | `Observability` | Event listener that forwards domain events to the telemetry provider. This decouples business logic from telemetry by... |
| [`TelemetryFactory`](https://github.com/evansims/openfga-php/blob/main/./Observability/TelemetryFactory.md) | `Observability` | Factory for creating telemetry providers with OpenTelemetry integration. This factory provides convenient methods for... |
| [`TelemetryService`](https://github.com/evansims/openfga-php/blob/main/./Services/TelemetryService.md) | `Services` | Service implementation for managing telemetry and observability in OpenFGA operations. Provides a higher-level abstra... |
| [`TokenAuthentication`](https://github.com/evansims/openfga-php/blob/main/./Authentication/TokenAuthentication.md) | `Authentication` | Token-based authentication strategy for OpenFGA client. This authentication strategy uses a pre-shared token (such as... |
| [`Transformer`](https://github.com/evansims/openfga-php/blob/main/./Transformer.md) | `OpenFGA` | OpenFGA DSL Transformer implementation for authorization model conversions. This class provides complete implementati... |
| [`Translator`](https://github.com/evansims/openfga-php/blob/main/./Translation/Translator.md) | `Translation` | Translation service for OpenFGA SDK messages. This implementation provides centralized message translation with param... |
| [`Tuple`](https://github.com/evansims/openfga-php/blob/main/./Models/Tuple.md) | `Models` | Represents a stored relationship tuple in your authorization system. A Tuple is a relationship record that exists in ... |
| [`TupleChange`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleChange.md) | `Models` | Represents a change to a relationship tuple in your authorization store. When you modify relationships in OpenFGA (ad... |
| [`TupleChanges`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TupleChanges.md) | `Models\Collections` | |
| [`TupleFilterService`](https://github.com/evansims/openfga-php/blob/main/./Services/TupleFilterService.md) | `Services` | Default implementation of TupleFilterServiceInterface. Provides efficient duplicate filtering for tuple operations us... |
| [`TupleKey`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleKey.md) | `Models` | Represents a relationship tuple key defining a connection between user, relation, and object. A TupleKey is the funda... |
| [`TupleKeys`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TupleKeys.md) | `Models\Collections` | Collection implementation for OpenFGA tuple key objects. This class provides a concrete implementation for managing c... |
| [`TupleService`](https://github.com/evansims/openfga-php/blob/main/./Services/TupleService.md) | `Services` | Service implementation for managing OpenFGA relationship tuples. Provides business-focused operations for working wit... |
| [`TupleToUsersetV1`](https://github.com/evansims/openfga-php/blob/main/./Models/TupleToUsersetV1.md) | `Models` | Represents a tuple-to-userset relationship that derives permissions from related objects. This enables complex author... |
| [`Tuples`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Tuples.md) | `Models\Collections` | Collection implementation for OpenFGA tuple objects. This class provides a concrete implementation for managing colle... |
| [`TypeDefinition`](https://github.com/evansims/openfga-php/blob/main/./Models/TypeDefinition.md) | `Models` | Represents a type definition in your authorization model. A TypeDefinition defines an object type (like "document," "... |
| [`TypeDefinitionRelations`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TypeDefinitionRelations.md) | `Models\Collections` | |
| [`TypeDefinitions`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/TypeDefinitions.md) | `Models\Collections` | Collection implementation for OpenFGA type definition objects. This class provides a concrete implementation for mana... |
| [`TypedWildcard`](https://github.com/evansims/openfga-php/blob/main/./Models/TypedWildcard.md) | `Models` | Represents a wildcard that matches all users of a specific type. In authorization models, you sometimes want to grant... |
| [`User`](https://github.com/evansims/openfga-php/blob/main/./Models/User.md) | `Models` | Represents a user or user specification in authorization contexts. A User can represent different types of entities i... |
| [`UserObject`](https://github.com/evansims/openfga-php/blob/main/./Models/UserObject.md) | `Models` | Represents a specific user object with type and identifier. A UserObject provides a structured way to represent users... |
| [`UserTypeFilter`](https://github.com/evansims/openfga-php/blob/main/./Models/UserTypeFilter.md) | `Models` | Represents a filter for limiting users by type and optional relation. UserTypeFilter allows you to constrain authoriz... |
| [`UserTypeFilters`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UserTypeFilters.md) | `Models\Collections` | |
| [`Users`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Users.md) | `Models\Collections` | |
| [`UsersList`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UsersList.md) | `Models\Collections` | |
| [`UsersListUser`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersListUser.md) | `Models` | Represents a user entry in a users list response. UsersListUser provides a simple wrapper around user identifiers ret... |
| [`Userset`](https://github.com/evansims/openfga-php/blob/main/./Models/Userset.md) | `Models` | Represents a userset specification for computing groups of users. A Userset defines how to compute a collection of us... |
| [`UsersetTree`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetTree.md) | `Models` | Represents the evaluation tree for determining user access. When OpenFGA evaluates whether a user has access to an ob... |
| [`UsersetTreeDifference`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetTreeDifference.md) | `Models` | Represents a difference operation node in authorization evaluation trees. UsersetTreeDifference computes the differen... |
| [`UsersetTreeTupleToUserset`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetTreeTupleToUserset.md) | `Models` | Represents a tuple-to-userset operation node in authorization evaluation trees. UsersetTreeTupleToUserset defines how... |
| [`UsersetUnion`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/UsersetUnion.md) | `Models\Collections` | |
| [`UsersetUser`](https://github.com/evansims/openfga-php/blob/main/./Models/UsersetUser.md) | `Models` | Represents a user reference through a userset relationship. UsersetUser defines a user specification in the format "o... |
| [`Usersets`](https://github.com/evansims/openfga-php/blob/main/./Models/Collections/Usersets.md) | `Models\Collections` | |
| [`ValidationService`](https://github.com/evansims/openfga-php/blob/main/./Schemas/ValidationService.md) | `Schemas` | Service for validating data against schemas. This service encapsulates validation logic, separating it from object co... |
| [`WriteAssertionsRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/WriteAssertionsRequest.md) | `Requests` | Request for writing test assertions to validate authorization model behavior. This request stores test assertions tha... |
| [`WriteAssertionsResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/WriteAssertionsResponse.md) | `Responses` | Response confirming successful writing of test assertions. This response indicates that test assertions have been suc... |
| [`WriteTuplesRequest`](https://github.com/evansims/openfga-php/blob/main/./Requests/WriteTuplesRequest.md) | `Requests` | Request for writing and deleting relationship tuples in OpenFGA. This request enables batch creation and deletion of ... |
| [`WriteTuplesResponse`](https://github.com/evansims/openfga-php/blob/main/./Responses/WriteTuplesResponse.md) | `Responses` | Response for tuple writing operations supporting both transactional and non-transactional modes. This response handle... |
| [`YamlParser`](https://github.com/evansims/openfga-php/blob/main/./Translation/YamlParser.md) | `Translation` | Simple YAML parser for translation files. This lightweight YAML parser handles the specific structure used by OpenFGA... |
##### All Enumerations
| Enum | Namespace | Description |
| ------------------------------------------------------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [`AuthenticationError`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/AuthenticationError.md) | `Exceptions` | Authentication error types for the OpenFGA SDK. Defines specific authentication failure scenarios that can occur when... |
| [`ClientError`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/ClientError.md) | `Exceptions` | General client error types for the OpenFGA SDK. Defines high-level error categories that can occur when using the SDK... |
| [`ConfigurationError`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/ConfigurationError.md) | `Exceptions` | Configuration error types for the OpenFGA SDK. Defines specific configuration-related failures that can occur when se... |
| [`Consistency`](https://github.com/evansims/openfga-php/blob/main/./Models/Enums/Consistency.md) | `Models\Enums` | Consistency levels for OpenFGA authorization queries. This enum defines the available consistency levels that control... |
| [`Language`](https://github.com/evansims/openfga-php/blob/main/./Language.md) | `OpenFGA` | Supported languages for OpenFGA SDK internationalization. This enum represents all available languages for SDK messag... |
| [`Messages`](https://github.com/evansims/openfga-php/blob/main/./Messages.md) | `OpenFGA` | Centralized message keys for all exception messages in the OpenFGA PHP SDK. This enum provides type-safe access to al... |
| [`NetworkError`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/NetworkError.md) | `Exceptions` | Network error types for the OpenFGA SDK. Defines specific network and HTTP-related failures that can occur when commu... |
| [`RequestMethod`](https://github.com/evansims/openfga-php/blob/main/./Network/RequestMethod.md) | `Network` | HTTP request methods supported by the OpenFGA API. This enum defines the specific HTTP methods used for communicating... |
| [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/./Models/Enums/SchemaVersion.md) | `Models\Enums` | OpenFGA authorization model schema versions. This enum defines the supported schema versions for authorization models... |
| [`SerializationError`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/SerializationError.md) | `Exceptions` | Serialization error types for the OpenFGA SDK. Defines specific serialization and data processing failures that can o... |
| [`TupleOperation`](https://github.com/evansims/openfga-php/blob/main/./Models/Enums/TupleOperation.md) | `Models\Enums` | Operations that can be performed on relationship tuples in OpenFGA. This enum defines the available operations for ma... |
| [`TypeName`](https://github.com/evansims/openfga-php/blob/main/./Models/Enums/TypeName.md) | `Models\Enums` | Data types supported in OpenFGA condition parameters. This enum defines the available data types that can be used for... |
<!-- End of evansims/openfga-php/docs/API/API-Index.md -->
<!-- Source: evansims/openfga-php/docs/API/Client.md -->
### Client
OpenFGA Client implementation for relationship-based access control operations. This client provides a complete implementation of the OpenFGA API, supporting all core operations including store management, authorization model configuration, relationship tuple operations, and authorization checks. The client uses PSR-7, PSR-17 and PSR-18 HTTP standards and implements the Result pattern for error handling. The client supports multiple authentication methods including OAuth 2.0 Client Credentials flow and pre-shared key authentication, with automatic token management and retry capabilities for reliable operation.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Constants](#constants)
- [Methods](#methods)
- [`batchCheck()`](#batchcheck)
- [`check()`](#check)
- [`createAuthorizationModel()`](#createauthorizationmodel)
- [`createStore()`](#createstore)
- [`deleteStore()`](#deletestore)
- [`dsl()`](#dsl)
- [`expand()`](#expand)
- [`getAuthorizationModel()`](#getauthorizationmodel)
- [`getLanguage()`](#getlanguage)
- [`getLanguageEnum()`](#getlanguageenum)
- [`getLastRequest()`](#getlastrequest)
- [`getLastResponse()`](#getlastresponse)
- [`getStore()`](#getstore)
- [`listAuthorizationModels()`](#listauthorizationmodels)
- [`listObjects()`](#listobjects)
- [`listStores()`](#liststores)
- [`listTupleChanges()`](#listtuplechanges)
- [`listUsers()`](#listusers)
- [`readAssertions()`](#readassertions)
- [`readTuples()`](#readtuples)
- [`streamedListObjects()`](#streamedlistobjects)
- [`writeAssertions()`](#writeassertions)
- [`writeTuples()`](#writetuples)
</details>
#### Namespace
`OpenFGA`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Client.php)
#### Implements
- [`ClientInterface`](https://github.com/evansims/openfga-php/blob/main/ClientInterface.md)
#### Related Classes
- [ClientInterface](https://github.com/evansims/openfga-php/blob/main/ClientInterface.md) (interface)
#### Constants
| Name | Value | Description |
| --------- | ------- | ----------------------------------- |
| `VERSION` | `1.6.0` | The version of the OpenFGA PHP SDK. |
#### Methods
##### batchCheck
```php
public function batchCheck(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
OpenFGA\Models\Collections\BatchCheckItemsInterface $checks,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Performs multiple authorization checks in a single batch request. This method allows checking multiple user-object relationships simultaneously for better performance when multiple authorization decisions are needed. Each check in the batch has a correlation ID to map results back to the original requests. The batch check operation supports the same features as individual checks: contextual tuples, custom contexts, and detailed error information for each check.
**Batch checking multiple permissions efficiently:**
```php
$checks = new BatchCheckItems([
new BatchCheckItem(
tupleKey: new TupleKey('user:anne', 'viewer', 'document:budget'),
correlationId: 'check-anne-viewer'
),
new BatchCheckItem(
tupleKey: new TupleKey('user:bob', 'editor', 'document:budget'),
correlationId: 'check-bob-editor'
),
new BatchCheckItem(
tupleKey: new TupleKey('user:charlie', 'owner', 'document:roadmap'),
correlationId: 'check-charlie-owner'
),
]);
$result = $client->batchCheck(
store: 'store-id',
model: 'model-id',
checks: $checks
);
if ($result->success()) {
$responses = $result->value()->getResults();
foreach ($responses as $response) {
echo $response->getCorrelationId() . ': ' .
($response->getAllowed() ? 'ALLOWED' : 'DENIED') . "\n";
}
}
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L123)
###### Parameters
| Name | Type | Description |
| --------- | -------------------------------------------------------------------------------------- | ------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$checks` | [`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/BatchCheckItemsInterface.md) | The batch check items |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — The batch check results
##### check
```php
public function check(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
OpenFGA\Models\TupleKeyInterface $tuple,
?bool $trace = NULL,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Checks if a user has a specific relationship with an object. Performs an authorization check to determine if a user has a particular relationship with an object based on the configured authorization model. This is the core operation for making authorization decisions in OpenFGA.
**Basic permission check:**
```php
$result = $client->check(
store: 'store-id',
model: 'model-id',
tuple: new TupleKey('user:anne', 'reader', 'document:budget')
);
if ($result->success()) {
$allowed = $result->value()->getAllowed();
if ($allowed) {
// User has permission
}
}
```
**Check with contextual tuples:**
```php
$contextualTuples = new TupleKeys([
new TupleKey('user:anne', 'member', 'team:finance')
]);
$result = $client->check(
store: 'store-id',
model: 'model-id',
tuple: new TupleKey('user:anne', 'reader', 'document:budget'),
contextualTuples: $contextualTuples
);
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L145)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$tuple` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The relationship to check |
| `$trace` | `bool` | `null` | Whether to include a trace in the response |
| `$context` | `object` | `null` | Additional context for the check |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains CheckResponseInterface, Failure contains Throwable
##### createAuthorizationModel
```php
public function createAuthorizationModel(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\Collections\TypeDefinitionsInterface $typeDefinitions,
?OpenFGA\Models\Collections\ConditionsInterface $conditions = NULL,
OpenFGA\Models\Enums\SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Creates a new authorization model with the given type definitions and conditions. Authorization models define the permission structure for your application, including object types, relationships, and how permissions are computed. Models are immutable once created and identified by a unique ID.
**Creating a document authorization model with DSL (recommended):**
```php
// Using DSL is usually easier than manually building type definitions
$dsl = '
model
schema 1.1
type user
type document
relations
define owner: [user]
define editor: [user] or owner
define viewer: [user] or editor
';
$authModel = $client->dsl($dsl)->unwrap();
$result = $client->createAuthorizationModel(
store: 'store-id',
typeDefinitions: $authModel->getTypeDefinitions()
);
if ($result->success()) {
$modelId = $result->value()->getAuthorizationModelId();
echo "Created model: {$modelId}";
}
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L175)
###### Parameters
| Name | Type | Description |
| ------------------ | -------------------------------------------------------------------------------- | ---------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to create the model in |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | The type definitions for the model |
| `$conditions` | [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` | The conditions for the model |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The schema version to use (default: 1.1) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains CreateAuthorizationModelResponseInterface, Failure contains Throwable
##### createStore
```php
public function createStore(string $name): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Creates a new store with the given name. Stores provide data isolation for different applications or environments. Each store maintains its own authorization models, relationship tuples, and provides complete separation from other stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L198)
###### Parameters
| Name | Type | Description |
| ------- | -------- | -------------------------- |
| `$name` | `string` | The name for the new store |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains CreateStoreResponseInterface, Failure contains Throwable
##### deleteStore
```php
public function deleteStore(
OpenFGA\Models\StoreInterface|string $store,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Deletes a store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L216)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | ------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to delete |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains DeleteStoreResponseInterface, Failure contains Throwable
##### dsl
```php
public function dsl(string $dsl): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Parses a DSL string and returns an AuthorizationModel. The Domain Specific Language (DSL) provides a human-readable way to define authorization models using intuitive syntax for relationships and permissions. This method converts DSL text into a structured authorization model object.
**Parse a complete authorization model from DSL:**
```php
$dsl = '
model
schema 1.1
type user
type organization
relations
define member: [user]
type document
relations
define owner: [user]
define editor: [user, organization#member] or owner
define viewer: [user, organization#member] or editor
';
$result = $client->dsl($dsl);
if ($result->success()) {
$authModel = $result->value();
echo "Parsed model with " . count($authModel->getTypeDefinitions()) . " types";
}
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L235)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ----------------------- |
| `$dsl` | `string` | The DSL string to parse |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains AuthorizationModelInterface, Failure contains Throwable
##### expand
```php
public function expand(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\TupleKeyInterface $tuple,
?OpenFGA\Models\AuthorizationModelInterface|string|null $model = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Expands a relationship tuple to show all users that have the relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L257)
###### Parameters
| Name | Type | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuple |
| `$tuple` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The tuple to expand |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `null` | `string` | `null` | The authorization model to use |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ExpandResponseInterface, Failure contains Throwable
##### getAuthorizationModel
```php
public function getAuthorizationModel(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Retrieves an authorization model by ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L283)
###### Parameters
| Name | Type | Description |
| -------- | -------------------------------------------------------------------------------------- | ------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the model |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The model to retrieve |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains GetAuthorizationModelResponseInterface, Failure contains Throwable
##### getLanguage
```php
public function getLanguage(): string
```
Get the configured language for i18n translations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L302)
###### Returns
`string` — The configured language code
##### getLanguageEnum
```php
public function getLanguageEnum(): Language
```
Get the configured language enum for type-safe access. Returns the Language enum representing the currently configured language, providing access to language metadata and type-safe operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L315)
###### Returns
[`Language`](https://github.com/evansims/openfga-php/blob/main/Language.md) — The configured language enum
##### getLastRequest
```php
public function getLastRequest(): ?Psr\Http\Message\RequestInterface
```
Retrieves the last HTTP request made by the client.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L326)
###### Returns
`Psr\Http\Message\RequestInterface` | `null`
##### getLastResponse
```php
public function getLastResponse(): ?Psr\Http\Message\ResponseInterface
```
Retrieves the last HTTP response received by the client.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L339)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null`
##### getStore
```php
public function getStore(
OpenFGA\Models\StoreInterface|string $store,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Retrieves store details by ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L352)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | --------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to retrieve |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains GetStoreResponseInterface, Failure contains Throwable
##### listAuthorizationModels
```php
public function listAuthorizationModels(
OpenFGA\Models\StoreInterface|string $store,
?string $continuationToken = NULL,
?int $pageSize = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists authorization models in a store with pagination.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L371)
###### Parameters
| Name | Type | Description |
| -------------------- | ------------------------------------------------------------ | ----------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to list models from |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of models to return (must be positive) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListAuthorizationModelsResponseInterface, Failure contains Throwable
##### listObjects
```php
public function listObjects(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists objects that have a specific relationship with a user.
**List all documents a user can view:**
```php
$result = $client->listObjects(
store: 'store-id',
model: 'model-id',
type: 'document',
relation: 'viewer',
user: 'user:anne'
);
if ($result->success()) {
$objects = $result->value()->getObjects();
echo "Anne can view " . count($objects) . " documents:\n";
foreach ($objects as $object) {
echo "- {$object}\n";
}
}
```
**List objects with contextual evaluation:**
```php
// Check what documents anne can edit, considering her team membership
$contextualTuples = new TupleKeys([
new TupleKey('user:anne', 'member', 'team:engineering')
]);
$result = $client->listObjects(
store: 'store-id',
model: 'model-id',
type: 'document',
relation: 'editor',
user: 'user:anne',
contextualTuples: $contextualTuples
);
/
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L396)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The type of objects to list |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListObjectsResponseInterface, Failure contains Throwable
##### listStores
```php
public function listStores(
?string $continuationToken = NULL,
?int $pageSize = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists all stores with pagination.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L428)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | ---------------------------------- |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of stores to return |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListStoresResponseInterface, Failure contains Throwable
##### listTupleChanges
```php
public function listTupleChanges(
OpenFGA\Models\StoreInterface|string $store,
?string $continuationToken = NULL,
?int $pageSize = NULL,
?string $type = NULL,
?DateTimeImmutable $startTime = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists changes to relationship tuples in a store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L449)
###### Parameters
| Name | Type | Description |
| -------------------- | ------------------------------------------------------------ | ------------------------------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to list changes for |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of changes to return |
| `$type` | `string` | `null` | Filter changes by type |
| `$startTime` | `DateTimeImmutable` | `null` | Only include changes at or after this time (inclusive) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListTupleChangesResponseInterface, Failure contains Throwable
##### listUsers
```php
public function listUsers(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
string $object,
string $relation,
OpenFGA\Models\Collections\UserTypeFiltersInterface $userFilters,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Lists users that have a specific relationship with an object.
**List all users who can view a document:**
```php
$userFilters = new UserTypeFilters([
new UserTypeFilter('user') // Only include direct users, not groups
]);
$result = $client->listUsers(
store: 'store-id',
model: 'model-id',
object: 'document:budget',
relation: 'viewer',
userFilters: $userFilters
);
if ($result->success()) {
$users = $result->value()->getUsers();
echo "Users who can view the budget document:\n";
foreach ($users as $user) {
echo "- {$user}\n";
}
}
```
**Find both users and groups with access:**
```php
$userFilters = new UserTypeFilters([
new UserTypeFilter('user'),
new UserTypeFilter('group')
]);
$result = $client->listUsers(
store: 'store-id',
model: 'model-id',
object: 'document:sensitive',
relation: 'editor',
userFilters: $userFilters
);
/
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L475)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$object` | `string` | The object to check relationships for |
| `$relation` | `string` | The relationship to check |
| `$userFilters` | [`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UserTypeFiltersInterface.md) | Filters for user types to include |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListUsersResponseInterface, Failure contains Throwable
##### readAssertions
```php
public function readAssertions(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Retrieves assertions for an authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L507)
###### Parameters
| Name | Type | Description |
| -------- | -------------------------------------------------------------------------------------- | ------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the model |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The model to get assertions for |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ReadAssertionsResponseInterface, Failure contains Throwable
##### readTuples
```php
public function readTuples(
OpenFGA\Models\StoreInterface|string $store,
?OpenFGA\Models\TupleKeyInterface $tuple = NULL,
?string $continuationToken = NULL,
?int $pageSize = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Reads relationship tuples from a store with optional filtering and pagination.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L527)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------------------------------------------------- | ---------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to read from |
| `$tuple` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | `null` | Filter tuples by this key (return all if null) |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of tuples to return |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ReadTuplesResponseInterface, Failure contains Throwable
##### streamedListObjects
```php
public function streamedListObjects(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
?object $context = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $contextualTuples = NULL,
?OpenFGA\Models\Enums\Consistency $consistency = NULL,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Streams objects that a user has a specific relationship with. Returns all objects of a given type that the specified user has a relationship with, using a streaming response for memory-efficient processing of large result sets. This is ideal for handling thousands of objects without loading them all into memory.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L553)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The object type to find |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains Generator<StreamedListObjectsResponseInterface>, Failure contains Throwable
##### writeAssertions
```php
public function writeAssertions(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
OpenFGA\Models\Collections\AssertionsInterface $assertions,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Creates or updates assertions for an authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L585)
###### Parameters
| Name | Type | Description |
| ------------- | -------------------------------------------------------------------------------------- | ---------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the model |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The model to update assertions for |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to upsert |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains WriteAssertionsResponseInterface, Failure contains Throwable
##### writeTuples
```php
public function writeTuples(
OpenFGA\Models\StoreInterface|string $store,
OpenFGA\Models\AuthorizationModelInterface|string $model,
?OpenFGA\Models\Collections\TupleKeysInterface $writes = NULL,
?OpenFGA\Models\Collections\TupleKeysInterface $deletes = NULL,
bool $transactional = true,
int $maxParallelRequests = 1,
int $maxTuplesPerChunk = 100,
int $maxRetries = 0,
float $retryDelaySeconds = 1.0,
bool $stopOnFirstError = false,
): OpenFGA\Results\FailureInterface|OpenFGA\Results\SuccessInterface
```
Writes or deletes relationship tuples in a store. This method supports both transactional (all-or-nothing) and non-transactional (independent operations) modes. In transactional mode, all operations must succeed or the entire request fails. In non-transactional mode, operations are processed independently with detailed success/failure tracking.
**Transactional write (all-or-nothing):**
```php
// Create relationships - all succeed or all fail together
$writes = new TupleKeys([
new TupleKey('user:anne', 'owner', 'document:budget'),
new TupleKey('user:bob', 'viewer', 'document:budget'),
new TupleKey('user:charlie', 'editor', 'document:roadmap'),
]);
$result = $client->writeTuples(
store: 'store-id',
model: 'model-id',
writes: $writes
);
if ($result->success()) {
echo "Successfully wrote " . count($writes) . " relationships";
}
```
**Non-transactional batch processing:**
```php
// Process large datasets with parallel execution and partial success handling
$writes = new TupleKeys([
// ... hundreds or thousands of tuples
]);
$result = $client->writeTuples(
store: 'store-id',
model: 'model-id',
writes: $writes,
transactional: false,
maxParallelRequests: 5,
maxTuplesPerChunk: 50,
maxRetries: 2
);
$result->success(function($response) {
if ($response->isCompleteSuccess()) {
echo "All operations succeeded\n";
} elseif ($response->isPartialSuccess()) {
echo "Partial success: {$response->getSuccessfulChunks()}/{$response->getTotalChunks()} chunks\n";
foreach ($response->getErrors() as $error) {
echo "Error: " . $error->getMessage() . "\n";
}
}
});
```
**Updating permissions by adding and removing tuples:**
```php
$writes = new TupleKeys([
new TupleKey('user:anne', 'editor', 'document:budget'), // Promote anne to editor
]);
$deletes = new TupleKeys([
new TupleKey('user:bob', 'viewer', 'document:budget'), // Remove bob's access
]);
$client->writeTuples(
store: 'store-id',
model: 'model-id',
writes: $writes,
deletes: $deletes
);
/
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/Client.php#L607)
###### Parameters
| Name | Type | Description |
| ---------------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to modify |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to write (create or update) |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to delete |
| `$transactional` | `bool` | Whether to use transactional mode (default: true) |
| `$maxParallelRequests` | `int` | Maximum concurrent requests (non-transactional only, default: 1) |
| `$maxTuplesPerChunk` | `int` | Maximum tuples per chunk (non-transactional only, default: 100) |
| `$maxRetries` | `int` | Maximum retry attempts (non-transactional only, default: 0) |
| `$retryDelaySeconds` | `float` | Retry delay in seconds (non-transactional only, default: 1.0) |
| `$stopOnFirstError` | `bool` | Stop on first error (non-transactional only, default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains WriteTuplesResponseInterface, Failure contains Throwable
<!-- End of evansims/openfga-php/docs/API/Client.md -->
<!-- Source: evansims/openfga-php/docs/API/ClientInterface.md -->
### ClientInterface
OpenFGA Client Interface for relationship-based access control operations. This interface defines the complete API for interacting with OpenFGA services, providing methods for managing stores, authorization models, relationship tuples, and performing authorization checks. The client implements the Result pattern, returning Success or Failure objects instead of throwing exceptions. All operations support OpenFGA's core concepts including stores for data isolation, authorization models for defining permission structures, and relationship tuples for expressing user-object relationships.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`batchCheck()`](#batchcheck)
- [`check()`](#check)
- [`createAuthorizationModel()`](#createauthorizationmodel)
- [`createStore()`](#createstore)
- [`deleteStore()`](#deletestore)
- [`dsl()`](#dsl)
- [`expand()`](#expand)
- [`getAuthorizationModel()`](#getauthorizationmodel)
- [`getLastRequest()`](#getlastrequest)
- [`getLastResponse()`](#getlastresponse)
- [`getStore()`](#getstore)
- [`listAuthorizationModels()`](#listauthorizationmodels)
- [`listObjects()`](#listobjects)
- [`listStores()`](#liststores)
- [`listTupleChanges()`](#listtuplechanges)
- [`listUsers()`](#listusers)
- [`readAssertions()`](#readassertions)
- [`readTuples()`](#readtuples)
- [`streamedListObjects()`](#streamedlistobjects)
- [`writeAssertions()`](#writeassertions)
- [`writeTuples()`](#writetuples)
</details>
#### Namespace
`OpenFGA`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php)
#### Related Classes
- [Client](https://github.com/evansims/openfga-php/blob/main/Client.md) (implementation)
#### Methods
##### batchCheck
```php
public function batchCheck(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
BatchCheckItemsInterface $checks,
): FailureInterface|SuccessInterface
```
Performs multiple authorization checks in a single batch request. This method allows checking multiple user-object relationships simultaneously for better performance when multiple authorization decisions are needed. Each check in the batch has a correlation ID to map results back to the original requests. The batch check operation supports the same features as individual checks: contextual tuples, custom contexts, and detailed error information for each check.
**Batch checking multiple permissions efficiently:**
```php
$checks = new BatchCheckItems([
new BatchCheckItem(
tupleKey: new TupleKey('user:anne', 'viewer', 'document:budget'),
correlationId: 'check-anne-viewer'
),
new BatchCheckItem(
tupleKey: new TupleKey('user:bob', 'editor', 'document:budget'),
correlationId: 'check-bob-editor'
),
new BatchCheckItem(
tupleKey: new TupleKey('user:charlie', 'owner', 'document:roadmap'),
correlationId: 'check-charlie-owner'
),
]);
$result = $client->batchCheck(
store: 'store-id',
model: 'model-id',
checks: $checks
);
if ($result->success()) {
$responses = $result->value()->getResults();
foreach ($responses as $response) {
echo $response->getCorrelationId() . ': ' .
($response->getAllowed() ? 'ALLOWED' : 'DENIED') . "\n";
}
}
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L86)
###### Parameters
| Name | Type | Description |
| --------- | -------------------------------------------------------------------------------------- | ------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$checks` | [`BatchCheckItemsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/BatchCheckItemsInterface.md) | The batch check items |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — The batch check results
##### check
```php
public function check(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
TupleKeyInterface $tuple,
bool|null $trace = NULL,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Checks if a user has a specific relationship with an object. Performs an authorization check to determine if a user has a particular relationship with an object based on the configured authorization model. This is the core operation for making authorization decisions in OpenFGA.
**Basic permission check:**
```php
$result = $client->check(
store: 'store-id',
model: 'model-id',
tuple: new TupleKey('user:anne', 'reader', 'document:budget')
);
if ($result->success()) {
$allowed = $result->value()->getAllowed();
if ($allowed) {
// User has permission
}
}
```
**Check with contextual tuples:**
```php
$contextualTuples = new TupleKeys([
new TupleKey('user:anne', 'member', 'team:finance')
]);
$result = $client->check(
store: 'store-id',
model: 'model-id',
tuple: new TupleKey('user:anne', 'reader', 'document:budget'),
contextualTuples: $contextualTuples
);
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L135)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to check against |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$tuple` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The relationship to check |
| `$trace` | `bool` | `null` | Whether to include a trace in the response |
| `$context` | `object` | `null` | Additional context for the check |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains CheckResponseInterface, Failure contains Throwable
##### createAuthorizationModel
```php
public function createAuthorizationModel(
StoreInterface|string $store,
TypeDefinitionsInterface $typeDefinitions,
ConditionsInterface|null $conditions = NULL,
SchemaVersion $schemaVersion = OpenFGA\Models\Enums\SchemaVersion::V1_1,
): FailureInterface|SuccessInterface
```
Creates a new authorization model with the given type definitions and conditions. Authorization models define the permission structure for your application, including object types, relationships, and how permissions are computed. Models are immutable once created and identified by a unique ID.
**Creating a document authorization model with DSL (recommended):**
```php
// Using DSL is usually easier than manually building type definitions
$dsl = '
model
schema 1.1
type user
type document
relations
define owner: [user]
define editor: [user] or owner
define viewer: [user] or editor
';
$authModel = $client->dsl($dsl)->unwrap();
$result = $client->createAuthorizationModel(
store: 'store-id',
typeDefinitions: $authModel->getTypeDefinitions()
);
if ($result->success()) {
$modelId = $result->value()->getAuthorizationModelId();
echo "Created model: {$modelId}";
}
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L187)
###### Parameters
| Name | Type | Description |
| ------------------ | -------------------------------------------------------------------------------- | ---------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to create the model in |
| `$typeDefinitions` | [`TypeDefinitionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TypeDefinitionsInterface.md) | The type definitions for the model |
| `$conditions` | [`ConditionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/ConditionsInterface.md) | `null` | The conditions for the model |
| `$schemaVersion` | [`SchemaVersion`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/SchemaVersion.md) | The schema version to use (default: 1.1) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains CreateAuthorizationModelResponseInterface, Failure contains Throwable
##### createStore
```php
public function createStore(string $name): FailureInterface|SuccessInterface
```
Creates a new store with the given name. Stores provide data isolation for different applications or environments. Each store maintains its own authorization models, relationship tuples, and provides complete separation from other stores.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L206)
###### Parameters
| Name | Type | Description |
| ------- | -------- | -------------------------- |
| `$name` | `string` | The name for the new store |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains CreateStoreResponseInterface, Failure contains Throwable
##### deleteStore
```php
public function deleteStore(StoreInterface|string $store): FailureInterface|SuccessInterface
```
Deletes a store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L216)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | ------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to delete |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains DeleteStoreResponseInterface, Failure contains Throwable
##### dsl
```php
public function dsl(string $dsl): FailureInterface|SuccessInterface
```
Parses a DSL string and returns an AuthorizationModel. The Domain Specific Language (DSL) provides a human-readable way to define authorization models using intuitive syntax for relationships and permissions. This method converts DSL text into a structured authorization model object.
**Parse a complete authorization model from DSL:**
```php
$dsl = '
model
schema 1.1
type user
type organization
relations
define member: [user]
type document
relations
define owner: [user]
define editor: [user, organization#member] or owner
define viewer: [user, organization#member] or editor
';
$result = $client->dsl($dsl);
if ($result->success()) {
$authModel = $result->value();
echo "Parsed model with " . count($authModel->getTypeDefinitions()) . " types";
}
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L260)
###### Parameters
| Name | Type | Description |
| ------ | -------- | ----------------------- |
| `$dsl` | `string` | The DSL string to parse |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains AuthorizationModelInterface, Failure contains Throwable
##### expand
```php
public function expand(
StoreInterface|string $store,
TupleKeyInterface $tuple,
AuthorizationModelInterface|string|null $model = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Expands a relationship tuple to show all users that have the relationship.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L272)
###### Parameters
| Name | Type | Description |
| ------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the tuple |
| `$tuple` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | The tuple to expand |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | `null` | The authorization model to use |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ExpandResponseInterface, Failure contains Throwable
##### getAuthorizationModel
```php
public function getAuthorizationModel(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
): FailureInterface|SuccessInterface
```
Retrieves an authorization model by ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L287)
###### Parameters
| Name | Type | Description |
| -------- | -------------------------------------------------------------------------------------- | ------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the model |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The model to retrieve |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains GetAuthorizationModelResponseInterface, Failure contains Throwable
##### getLastRequest
```php
public function getLastRequest(): ?Psr\Http\Message\RequestInterface
```
Retrieves the last HTTP request made by the client.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L297)
###### Returns
`Psr\Http\Message\RequestInterface` | `null`
##### getLastResponse
```php
public function getLastResponse(): ?Psr\Http\Message\ResponseInterface
```
Retrieves the last HTTP response received by the client.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L304)
###### Returns
`Psr\Http\Message\ResponseInterface` | `null`
##### getStore
```php
public function getStore(StoreInterface|string $store): FailureInterface|SuccessInterface
```
Retrieves store details by ID.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L312)
###### Parameters
| Name | Type | Description |
| -------- | ------------------------------------------------------------ | --------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to retrieve |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains GetStoreResponseInterface, Failure contains Throwable
##### listAuthorizationModels
```php
public function listAuthorizationModels(
StoreInterface|string $store,
string|null $continuationToken = NULL,
int|null $pageSize = NULL,
): FailureInterface|SuccessInterface
```
Lists authorization models in a store with pagination.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L327)
###### Parameters
| Name | Type | Description |
| -------------------- | ------------------------------------------------------------ | ----------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to list models from |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of models to return (must be positive) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListAuthorizationModelsResponseInterface, Failure contains Throwable
##### listObjects
```php
public function listObjects(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Lists objects that have a specific relationship with a user.
**List all documents a user can view:**
```php
$result = $client->listObjects(
store: 'store-id',
model: 'model-id',
type: 'document',
relation: 'viewer',
user: 'user:anne'
);
if ($result->success()) {
$objects = $result->value()->getObjects();
echo "Anne can view " . count($objects) . " documents:\n";
foreach ($objects as $object) {
echo "- {$object}\n";
}
}
```
**List objects with contextual evaluation:**
```php
// Check what documents anne can edit, considering her team membership
$contextualTuples = new TupleKeys([
new TupleKey('user:anne', 'member', 'team:engineering')
]);
$result = $client->listObjects(
store: 'store-id',
model: 'model-id',
type: 'document',
relation: 'editor',
user: 'user:anne',
contextualTuples: $contextualTuples
);
/
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L377)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The type of objects to list |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListObjectsResponseInterface, Failure contains Throwable
##### listStores
```php
public function listStores(
string|null $continuationToken = NULL,
?int $pageSize = NULL,
): FailureInterface|SuccessInterface
```
Lists all stores with pagination.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L398)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------- | ---------------------------------- |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of stores to return |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListStoresResponseInterface, Failure contains Throwable
##### listTupleChanges
```php
public function listTupleChanges(
StoreInterface|string $store,
string|null $continuationToken = NULL,
?int $pageSize = NULL,
string|null $type = NULL,
DateTimeImmutable|null $startTime = NULL,
): FailureInterface|SuccessInterface
```
Lists changes to relationship tuples in a store.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L416)
###### Parameters
| Name | Type | Description |
| -------------------- | ------------------------------------------------------------ | ------------------------------------------------------ |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to list changes for |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of changes to return |
| `$type` | `string` | `null` | Filter changes by type |
| `$startTime` | `DateTimeImmutable` | `null` | Only include changes at or after this time (inclusive) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListTupleChangesResponseInterface, Failure contains Throwable
##### listUsers
```php
public function listUsers(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
string $object,
string $relation,
UserTypeFiltersInterface $userFilters,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Lists users that have a specific relationship with an object.
**List all users who can view a document:**
```php
$userFilters = new UserTypeFilters([
new UserTypeFilter('user') // Only include direct users, not groups
]);
$result = $client->listUsers(
store: 'store-id',
model: 'model-id',
object: 'document:budget',
relation: 'viewer',
userFilters: $userFilters
);
if ($result->success()) {
$users = $result->value()->getUsers();
echo "Users who can view the budget document:\n";
foreach ($users as $user) {
echo "- {$user}\n";
}
}
```
**Find both users and groups with access:**
```php
$userFilters = new UserTypeFilters([
new UserTypeFilter('user'),
new UserTypeFilter('group')
]);
$result = $client->listUsers(
store: 'store-id',
model: 'model-id',
object: 'document:sensitive',
relation: 'editor',
userFilters: $userFilters
);
/
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L471)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$object` | `string` | The object to check relationships for |
| `$relation` | `string` | The relationship to check |
| `$userFilters` | [`UserTypeFiltersInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/UserTypeFiltersInterface.md) | Filters for user types to include |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ListUsersResponseInterface, Failure contains Throwable
##### readAssertions
```php
public function readAssertions(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
): FailureInterface|SuccessInterface
```
Retrieves assertions for an authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L489)
###### Parameters
| Name | Type | Description |
| -------- | -------------------------------------------------------------------------------------- | ------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the model |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The model to get assertions for |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ReadAssertionsResponseInterface, Failure contains Throwable
##### readTuples
```php
public function readTuples(
StoreInterface|string $store,
?OpenFGA\Models\TupleKeyInterface $tuple = NULL,
string|null $continuationToken = NULL,
?int $pageSize = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Reads relationship tuples from a store with optional filtering and pagination.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L507)
###### Parameters
| Name | Type | Description |
| -------------------- | ---------------------------------------------------------------- | ---------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to read from |
| `$tuple` | [`TupleKeyInterface`](https://github.com/evansims/openfga-php/blob/main/Models/TupleKeyInterface.md) | `null` | Filter tuples by this key (return all if null) |
| `$continuationToken` | `string` | `null` | Token for pagination |
| `$pageSize` | `int` | `null` | Maximum number of tuples to return |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains ReadTuplesResponseInterface, Failure contains Throwable
##### streamedListObjects
```php
public function streamedListObjects(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
string $type,
string $relation,
string $user,
object|null $context = NULL,
TupleKeysInterface|null $contextualTuples = NULL,
Consistency|null $consistency = NULL,
): FailureInterface|SuccessInterface
```
Streams objects that a user has a specific relationship with. Returns all objects of a given type that the specified user has a relationship with, using a streaming response for memory-efficient processing of large result sets. This is ideal for handling thousands of objects without loading them all into memory.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L532)
###### Parameters
| Name | Type | Description |
| ------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to query |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$type` | `string` | The object type to find |
| `$relation` | `string` | The relationship to check |
| `$user` | `string` | The user to check relationships for |
| `$context` | `object` | `null` | Additional context for evaluation |
| `$contextualTuples` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Additional tuples for contextual evaluation |
| `$consistency` | [`Consistency`](https://github.com/evansims/openfga-php/blob/main/Models/Enums/Consistency.md) | `null` | Override the default consistency level |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains Generator<StreamedListObjectsResponseInterface>, Failure contains Throwable
##### writeAssertions
```php
public function writeAssertions(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
AssertionsInterface $assertions,
): FailureInterface|SuccessInterface
```
Creates or updates assertions for an authorization model.
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L551)
###### Parameters
| Name | Type | Description |
| ------------- | -------------------------------------------------------------------------------------- | ---------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store containing the model |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The model to update assertions for |
| `$assertions` | [`AssertionsInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/AssertionsInterface.md) | The assertions to upsert |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains WriteAssertionsResponseInterface, Failure contains Throwable
##### writeTuples
```php
public function writeTuples(
StoreInterface|string $store,
AuthorizationModelInterface|string $model,
TupleKeysInterface|null $writes = NULL,
TupleKeysInterface|null $deletes = NULL,
bool $transactional = true,
int $maxParallelRequests = 1,
int $maxTuplesPerChunk = 100,
int $maxRetries = 0,
float $retryDelaySeconds = 1.0,
bool $stopOnFirstError = false,
): FailureInterface|SuccessInterface
```
Writes or deletes relationship tuples in a store. This method supports both transactional (all-or-nothing) and non-transactional (independent operations) modes. In transactional mode, all operations must succeed or the entire request fails. In non-transactional mode, operations are processed independently with detailed success/failure tracking.
**Transactional write (all-or-nothing):**
```php
// Create relationships - all succeed or all fail together
$writes = new TupleKeys([
new TupleKey('user:anne', 'owner', 'document:budget'),
new TupleKey('user:bob', 'viewer', 'document:budget'),
new TupleKey('user:charlie', 'editor', 'document:roadmap'),
]);
$result = $client->writeTuples(
store: 'store-id',
model: 'model-id',
writes: $writes
);
if ($result->success()) {
echo "Successfully wrote " . count($writes) . " relationships";
}
```
**Non-transactional batch processing:**
```php
// Process large datasets with parallel execution and partial success handling
$writes = new TupleKeys([
// ... hundreds or thousands of tuples
]);
$result = $client->writeTuples(
store: 'store-id',
model: 'model-id',
writes: $writes,
transactional: false,
maxParallelRequests: 5,
maxTuplesPerChunk: 50,
maxRetries: 2
);
$result->success(function($response) {
if ($response->isCompleteSuccess()) {
echo "All operations succeeded\n";
} elseif ($response->isPartialSuccess()) {
echo "Partial success: {$response->getSuccessfulChunks()}/{$response->getTotalChunks()} chunks\n";
foreach ($response->getErrors() as $error) {
echo "Error: " . $error->getMessage() . "\n";
}
}
});
```
**Updating permissions by adding and removing tuples:**
```php
$writes = new TupleKeys([
new TupleKey('user:anne', 'editor', 'document:budget'), // Promote anne to editor
]);
$deletes = new TupleKeys([
new TupleKey('user:bob', 'viewer', 'document:budget'), // Remove bob's access
]);
$client->writeTuples(
store: 'store-id',
model: 'model-id',
writes: $writes,
deletes: $deletes
);
/
```
[View source](https://github.com/evansims/openfga-php/blob/main/src/ClientInterface.php#L636)
###### Parameters
| Name | Type | Description |
| ---------------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `$store` | [`StoreInterface`](https://github.com/evansims/openfga-php/blob/main/Models/StoreInterface.md) | `string` | The store to modify |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | `string` | The authorization model to use |
| `$writes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to write (create or update) |
| `$deletes` | [`TupleKeysInterface`](https://github.com/evansims/openfga-php/blob/main/Models/Collections/TupleKeysInterface.md) | `null` | Tuples to delete |
| `$transactional` | `bool` | Whether to use transactional mode (default: true) |
| `$maxParallelRequests` | `int` | Maximum concurrent requests (non-transactional only, default: 1) |
| `$maxTuplesPerChunk` | `int` | Maximum tuples per chunk (non-transactional only, default: 100) |
| `$maxRetries` | `int` | Maximum retry attempts (non-transactional only, default: 0) |
| `$retryDelaySeconds` | `float` | Retry delay in seconds (non-transactional only, default: 1.0) |
| `$stopOnFirstError` | `bool` | Stop on first error (non-transactional only, default: false) |
###### Returns
[`FailureInterface`](https://github.com/evansims/openfga-php/blob/main/Results/FailureInterface.md) | [`SuccessInterface`](https://github.com/evansims/openfga-php/blob/main/Results/SuccessInterface.md) — Success contains WriteTuplesResponseInterface, Failure contains Throwable
<!-- End of evansims/openfga-php/docs/API/ClientInterface.md -->
<!-- Source: evansims/openfga-php/docs/API/Language.md -->
### Language
Supported languages for OpenFGA SDK internationalization. This enum represents all available languages for SDK messages and error translations, providing type-safe language selection with rich metadata about each supported locale including native names, ISO codes, and text directionality.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Methods](#methods)
- [`apply()`](#apply)
- [`displayName()`](#displayname)
- [`isActive()`](#isactive)
- [`isRightToLeft()`](#isrighttoleft)
- [`isoCode()`](#isocode)
- [`locale()`](#locale)
- [`nativeName()`](#nativename)
- [`regionCode()`](#regioncode)
- [`withLocale()`](#withlocale)
</details>
#### Namespace
`OpenFGA`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Language.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| --------------------- | ------- | -------------------------------------- |
| `ChineseSimplified` | `zh_CN` | Chinese Simplified language support. |
| `Dutch` | `nl` | Dutch language support. |
| `English` | `en` | English language support (default). |
| `French` | `fr` | French language support. |
| `German` | `de` | German language support. |
| `Italian` | `it` | Italian language support. |
| `Japanese` | `ja` | Japanese language support. |
| `Korean` | `ko` | Korean language support. |
| `PortugueseBrazilian` | `pt_BR` | Brazilian Portuguese language support. |
| `Russian` | `ru` | Russian language support. |
| `Spanish` | `es` | Spanish language support. |
| `Swedish` | `sv` | Swedish language support. |
| `Turkish` | `tr` | Turkish language support. |
| `Ukrainian` | `uk` | Ukrainian language support. |
#### Cases
| Name | Value | Description |
| --------------------- | ------- | -------------------------------------- |
| `ChineseSimplified` | `zh_CN` | Chinese Simplified language support. |
| `Dutch` | `nl` | Dutch language support. |
| `English` | `en` | English language support (default). |
| `French` | `fr` | French language support. |
| `German` | `de` | German language support. |
| `Italian` | `it` | Italian language support. |
| `Japanese` | `ja` | Japanese language support. |
| `Korean` | `ko` | Korean language support. |
| `PortugueseBrazilian` | `pt_BR` | Brazilian Portuguese language support. |
| `Russian` | `ru` | Russian language support. |
| `Spanish` | `es` | Spanish language support. |
| `Swedish` | `sv` | Swedish language support. |
| `Turkish` | `tr` | Turkish language support. |
| `Ukrainian` | `uk` | Ukrainian language support. |
#### Methods
##### apply
```php
public function apply(): void
```
Apply this language as the active translation locale. Sets this language as the default locale for all subsequent translation operations until changed or reset.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L137)
###### Returns
`void`
##### displayName
```php
public function displayName(): string
```
Get the display name of the language in English. Returns the English name of the language for UI display and documentation purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L150)
###### Returns
`string` — The English name of the language
##### isActive
```php
public function isActive(): bool
```
Check if this language is the currently active locale. Determines whether this language is currently set as the default locale for translation operations.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L178)
###### Returns
`bool` — True if this is the active language
##### isRightToLeft
```php
public function isRightToLeft(): bool
```
Check if this language uses right-to-left text direction. Useful for UI implementations that need to adjust layout direction based on the selected language.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L209)
###### Returns
`bool` — True if the language is RTL
##### isoCode
```php
public function isoCode(): string
```
Get the ISO 639-1 two-letter language code. Returns the base language code without region specifier. For regional variants, this returns the primary language code.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L191)
###### Returns
`string` — The ISO 639-1 language code
##### locale
```php
public function locale(): string
```
Get the locale code for this language. Returns the full locale identifier including any region specifier (for example, "pt_BR" for Brazilian Portuguese).
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L224)
###### Returns
`string` — The locale code
##### nativeName
```php
public function nativeName(): string
```
Get the native name of the language. Returns the language name as written in that language, useful for language selection interfaces.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L237)
###### Returns
`string` — The native language name
##### regionCode
```php
public function regionCode(): string|null
```
Get the region code if this is a regional language variant. Returns the ISO 3166-1 alpha-2 country code for regional language variants, or null for generic language codes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L265)
###### Returns
`string` | `null` — The region code or null
##### withLocale
```php
public function withLocale(callable $callback): T
```
Execute a callback with this language as the active locale. Temporarily sets this language as the active locale, executes the provided callback, then restores the previous locale. This ensures proper cleanup even if the callback throws.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Language.php#L290)
###### Parameters
| Name | Type | Description |
| ----------- | ---------- | ----------- |
| `$callback` | `callable` | |
###### Returns
`T` — The result of the callback
<!-- End of evansims/openfga-php/docs/API/Language.md -->
<!-- Source: evansims/openfga-php/docs/API/Messages.md -->
### Messages
Centralized message keys for all exception messages in the OpenFGA PHP SDK. This enum provides type-safe access to all translatable message keys used throughout the library for exceptions, error messages, and user-facing text. Messages are organized by category and support parameter substitution for dynamic content through the translation system. All message keys map to translations in the translation files located in the translations/ directory, supporting multiple locales for internationalization.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Constants](#constants)
- [Cases](#cases)
- [Translation Tables](#translation-tables)
- [Methods](#methods)
- [`key()`](#key)
</details>
#### Namespace
`OpenFGA`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Messages.php)
#### Implements
- `UnitEnum`
- `BackedEnum`
#### Constants
| Name | Value | Description |
| -------------------------------------------- | ---------------------------------------------------------------- | ----------- |
| `ASSERTIONS_EMPTY_COLLECTION` | `assertions.empty_collection` | |
| `ASSERTIONS_INVALID_TUPLE_KEY` | `assertions.invalid_tuple_key` | |
| `AUTH_ACCESS_TOKEN_MUST_BE_STRING` | `auth.access_token_must_be_string` | |
| `AUTH_ERROR_TOKEN_EXPIRED` | `exception.auth.token_expired` | |
| `AUTH_ERROR_TOKEN_INVALID` | `exception.auth.token_invalid` | |
| `AUTH_EXPIRES_IN_MUST_BE_INTEGER` | `auth.expires_in_must_be_integer` | |
| `AUTH_INVALID_RESPONSE_FORMAT` | `auth.invalid_response_format` | |
| `AUTH_MISSING_REQUIRED_FIELDS` | `auth.missing_required_fields` | |
| `AUTH_USER_MESSAGE_TOKEN_EXPIRED` | `auth.user_message.token_expired` | |
| `AUTH_USER_MESSAGE_TOKEN_INVALID` | `auth.user_message.token_invalid` | |
| `BATCH_TUPLE_CHUNK_SIZE_EXCEEDED` | `validation.batch_tuple_chunk_size_exceeded` | |
| `BATCH_TUPLE_CHUNK_SIZE_POSITIVE` | `validation.batch_tuple_chunk_size_positive` | |
| `CLIENT_ERROR_AUTHENTICATION` | `exception.client.authentication` | |
| `CLIENT_ERROR_CONFIGURATION` | `exception.client.configuration` | |
| `CLIENT_ERROR_NETWORK` | `exception.client.network` | |
| `CLIENT_ERROR_SERIALIZATION` | `exception.client.serialization` | |
| `CLIENT_ERROR_VALIDATION` | `exception.client.validation` | |
| `COLLECTION_INVALID_ITEM_INSTANCE` | `collection.invalid_item_instance` | |
| `COLLECTION_INVALID_ITEM_TYPE_INTERFACE` | `collection.invalid_item_type_interface` | |
| `COLLECTION_INVALID_KEY_TYPE` | `collection.invalid_key_type` | |
| `COLLECTION_INVALID_POSITION` | `collection.invalid_position` | |
| `COLLECTION_INVALID_VALUE_TYPE` | `collection.invalid_value_type` | |
| `COLLECTION_KEY_MUST_BE_STRING` | `collection.key_must_be_string` | |
| `COLLECTION_UNDEFINED_ITEM_TYPE` | `collection.undefined_item_type` | |
| `CONFIG_ERROR_HTTP_CLIENT_MISSING` | `exception.config.http_client_missing` | |
| `CONFIG_ERROR_HTTP_REQUEST_FACTORY_MISSING` | `exception.config.http_request_factory_missing` | |
| `CONFIG_ERROR_HTTP_RESPONSE_FACTORY_MISSING` | `exception.config.http_response_factory_missing` | |
| `CONFIG_ERROR_HTTP_STREAM_FACTORY_MISSING` | `exception.config.http_stream_factory_missing` | |
| `CONFIG_ERROR_INVALID_LANGUAGE` | `exception.config.invalid_language` | |
| `CONFIG_ERROR_INVALID_RETRY_COUNT` | `exception.config.invalid_retry_count` | |
| `CONFIG_ERROR_INVALID_URL` | `exception.config.invalid_url` | |
| `CONSISTENCY_HIGHER_CONSISTENCY_DESCRIPTION` | `consistency.higher_consistency.description` | |
| `CONSISTENCY_MINIMIZE_LATENCY_DESCRIPTION` | `consistency.minimize_latency.description` | |
| `CONSISTENCY_UNSPECIFIED_DESCRIPTION` | `consistency.unspecified.description` | |
| `DSL_INPUT_EMPTY` | `dsl.input_empty` | |
| `DSL_INVALID_COMPUTED_USERSET` | `dsl.invalid_computed_userset` | |
| `DSL_INVALID_COMPUTED_USERSET_RELATION` | `dsl.invalid_computed_userset_relation` | |
| `DSL_PARSE_FAILED` | `dsl.parse_failed` | |
| `DSL_PATTERN_EMPTY` | `dsl.pattern_empty` | |
| `DSL_UNBALANCED_PARENTHESES_CLOSING` | `dsl.unbalanced_parentheses_closing` | |
| `DSL_UNBALANCED_PARENTHESES_OPENING` | `dsl.unbalanced_parentheses_opening` | |
| `DSL_UNRECOGNIZED_TERM` | `dsl.unrecognized_term` | |
| `INVALID_BATCH_CHECK_EMPTY` | `validation.batch_check_empty` | |
| `INVALID_CORRELATION_ID` | `validation.invalid_correlation_id` | |
| `JWT_INVALID_AUDIENCE` | `auth.jwt.invalid_audience` | |
| `JWT_INVALID_FORMAT` | `auth.jwt.invalid_format` | |
| `JWT_INVALID_HEADER` | `auth.jwt.invalid_header` | |
| `JWT_INVALID_ISSUER` | `auth.jwt.invalid_issuer` | |
| `JWT_INVALID_PAYLOAD` | `auth.jwt.invalid_payload` | |
| `JWT_MISSING_REQUIRED_CLAIMS` | `auth.jwt.missing_required_claims` | |
| `JWT_TOKEN_EXPIRED` | `auth.jwt.token_expired` | |
| `JWT_TOKEN_NOT_YET_VALID` | `auth.jwt.token_not_yet_valid` | |
| `MODEL_DUPLICATE_TYPE` | `model.duplicate_type` | |
| `MODEL_INVALID_IDENTIFIER_FORMAT` | `model.invalid_identifier_format` | |
| `MODEL_INVALID_TUPLE_KEY` | `model.invalid_tuple_key` | |
| `MODEL_LEAF_MISSING_CONTENT` | `model.leaf_missing_content` | |
| `MODEL_NO_MODELS_IN_STORE` | `model.no_models_in_store` | |
| `MODEL_SOURCE_INFO_FILE_EMPTY` | `model.source_info_file_empty` | |
| `MODEL_TYPE_DEFINITIONS_EMPTY` | `model.type_definitions_empty` | |
| `MODEL_TYPED_WILDCARD_TYPE_EMPTY` | `model.typed_wildcard_type_empty` | |
| `NETWORK_ERROR` | `network.error` | |
| `NETWORK_ERROR_CONFLICT` | `exception.network.conflict` | |
| `NETWORK_ERROR_FORBIDDEN` | `exception.network.forbidden` | |
| `NETWORK_ERROR_INVALID` | `exception.network.invalid` | |
| `NETWORK_ERROR_REQUEST` | `exception.network.request` | |
| `NETWORK_ERROR_SERVER` | `exception.network.server` | |
| `NETWORK_ERROR_TIMEOUT` | `exception.network.timeout` | |
| `NETWORK_ERROR_UNAUTHENTICATED` | `exception.network.unauthenticated` | |
| `NETWORK_ERROR_UNDEFINED_ENDPOINT` | `exception.network.undefined_endpoint` | |
| `NETWORK_ERROR_UNEXPECTED` | `exception.network.unexpected` | |
| `NETWORK_UNEXPECTED_STATUS` | `network.unexpected_status` | |
| `NO_LAST_REQUEST_FOUND` | `client.no_last_request_found` | |
| `REQUEST_CONTINUATION_TOKEN_EMPTY` | `request.continuation_token_empty` | |
| `REQUEST_MODEL_ID_EMPTY` | `request.model_id_empty` | |
| `REQUEST_OBJECT_EMPTY` | `request.object_empty` | |
| `REQUEST_OBJECT_TYPE_EMPTY` | `request.object_type_empty` | |
| `REQUEST_PAGE_SIZE_INVALID` | `request.page_size_invalid` | |
| `REQUEST_RELATION_EMPTY` | `request.relation_empty` | |
| `REQUEST_STORE_ID_EMPTY` | `request.store_id_empty` | |
| `REQUEST_STORE_NAME_EMPTY` | `request.store_name_empty` | |
| `REQUEST_TRANSACTIONAL_LIMIT_EXCEEDED` | `request.transactional_limit_exceeded` | |
| `REQUEST_TYPE_EMPTY` | `request.type_empty` | |
| `REQUEST_USER_EMPTY` | `request.user_empty` | |
| `RESPONSE_UNEXPECTED_TYPE` | `response.unexpected_type` | |
| `RESULT_FAILURE_NO_VALUE` | `result.failure_no_value` | |
| `RESULT_SUCCESS_NO_ERROR` | `result.success_no_error` | |
| `SCHEMA_CLASS_NOT_FOUND` | `schema.class_not_found` | |
| `SCHEMA_ITEM_TYPE_NOT_FOUND` | `schema.item_type_not_found` | |
| `SERIALIZATION_ERROR_COULD_NOT_ADD_ITEMS` | `exception.serialization.could_not_add_items_to_collection` | |
| `SERIALIZATION_ERROR_EMPTY_COLLECTION` | `exception.serialization.empty_collection` | |
| `SERIALIZATION_ERROR_INVALID_ITEM_TYPE` | `exception.serialization.invalid_item_type` | |
| `SERIALIZATION_ERROR_MISSING_REQUIRED_PARAM` | `exception.serialization.missing_required_constructor_parameter` | |
| `SERIALIZATION_ERROR_RESPONSE` | `exception.serialization.response` | |
| `SERIALIZATION_ERROR_UNDEFINED_ITEM_TYPE` | `exception.serialization.undefined_item_type` | |
| `SERVICE_HTTP_NOT_AVAILABLE` | `service.http_not_available` | |
| `SERVICE_SCHEMA_VALIDATOR_NOT_AVAILABLE` | `service.schema_validator_not_available` | |
| `SERVICE_STORE_REPOSITORY_NOT_AVAILABLE` | `service.store_repository_not_available` | |
| `SERVICE_TUPLE_FILTER_NOT_AVAILABLE` | `service.tuple_filter_not_available` | |
| `SERVICE_TUPLE_REPOSITORY_NOT_AVAILABLE` | `service.tuple_repository_not_available` | |
| `STORE_NAME_REQUIRED` | `store.name_required` | |
| `STORE_NAME_TOO_LONG` | `store.name_too_long` | |
| `STORE_NOT_FOUND` | `store.not_found` | |
| `TRANSLATION_FILE_NOT_FOUND` | `translation.file_not_found` | |
| `TRANSLATION_UNSUPPORTED_FORMAT` | `translation.unsupported_format` | |
| `TUPLE_OPERATION_DELETE_DESCRIPTION` | `tuple_operation.delete.description` | |
| `TUPLE_OPERATION_WRITE_DESCRIPTION` | `tuple_operation.write.description` | |
| `YAML_CANNOT_READ_FILE` | `yaml.cannot_read_file` | |
| `YAML_FILE_DOES_NOT_EXIST` | `yaml.file_does_not_exist` | |
| `YAML_INVALID_STRUCTURE` | `yaml.invalid_structure` | |
| `YAML_INVALID_SYNTAX_EMPTY_KEY` | `yaml.invalid_syntax_empty_key` | |
| `YAML_INVALID_SYNTAX_MISSING_COLON` | `yaml.invalid_syntax_missing_colon` | |
| `YAML_INVALID_SYNTAX_MISSING_VALUE` | `yaml.invalid_syntax_missing_value` | |
#### Cases
| Name | Value | Description |
| -------------------------------------------- | ---------------------------------------------------------------- | ----------- |
| `ASSERTIONS_EMPTY_COLLECTION` | `assertions.empty_collection` | |
| `ASSERTIONS_INVALID_TUPLE_KEY` | `assertions.invalid_tuple_key` | |
| `AUTH_ACCESS_TOKEN_MUST_BE_STRING` | `auth.access_token_must_be_string` | |
| `AUTH_ERROR_TOKEN_EXPIRED` | `exception.auth.token_expired` | |
| `AUTH_ERROR_TOKEN_INVALID` | `exception.auth.token_invalid` | |
| `AUTH_EXPIRES_IN_MUST_BE_INTEGER` | `auth.expires_in_must_be_integer` | |
| `AUTH_INVALID_RESPONSE_FORMAT` | `auth.invalid_response_format` | |
| `AUTH_MISSING_REQUIRED_FIELDS` | `auth.missing_required_fields` | |
| `AUTH_USER_MESSAGE_TOKEN_EXPIRED` | `auth.user_message.token_expired` | |
| `AUTH_USER_MESSAGE_TOKEN_INVALID` | `auth.user_message.token_invalid` | |
| `BATCH_TUPLE_CHUNK_SIZE_EXCEEDED` | `validation.batch_tuple_chunk_size_exceeded` | |
| `BATCH_TUPLE_CHUNK_SIZE_POSITIVE` | `validation.batch_tuple_chunk_size_positive` | |
| `CLIENT_ERROR_AUTHENTICATION` | `exception.client.authentication` | |
| `CLIENT_ERROR_CONFIGURATION` | `exception.client.configuration` | |
| `CLIENT_ERROR_NETWORK` | `exception.client.network` | |
| `CLIENT_ERROR_SERIALIZATION` | `exception.client.serialization` | |
| `CLIENT_ERROR_VALIDATION` | `exception.client.validation` | |
| `COLLECTION_INVALID_ITEM_INSTANCE` | `collection.invalid_item_instance` | |
| `COLLECTION_INVALID_ITEM_TYPE_INTERFACE` | `collection.invalid_item_type_interface` | |
| `COLLECTION_INVALID_KEY_TYPE` | `collection.invalid_key_type` | |
| `COLLECTION_INVALID_POSITION` | `collection.invalid_position` | |
| `COLLECTION_INVALID_VALUE_TYPE` | `collection.invalid_value_type` | |
| `COLLECTION_KEY_MUST_BE_STRING` | `collection.key_must_be_string` | |
| `COLLECTION_UNDEFINED_ITEM_TYPE` | `collection.undefined_item_type` | |
| `CONFIG_ERROR_HTTP_CLIENT_MISSING` | `exception.config.http_client_missing` | |
| `CONFIG_ERROR_HTTP_REQUEST_FACTORY_MISSING` | `exception.config.http_request_factory_missing` | |
| `CONFIG_ERROR_HTTP_RESPONSE_FACTORY_MISSING` | `exception.config.http_response_factory_missing` | |
| `CONFIG_ERROR_HTTP_STREAM_FACTORY_MISSING` | `exception.config.http_stream_factory_missing` | |
| `CONFIG_ERROR_INVALID_LANGUAGE` | `exception.config.invalid_language` | |
| `CONFIG_ERROR_INVALID_RETRY_COUNT` | `exception.config.invalid_retry_count` | |
| `CONFIG_ERROR_INVALID_URL` | `exception.config.invalid_url` | |
| `CONSISTENCY_HIGHER_CONSISTENCY_DESCRIPTION` | `consistency.higher_consistency.description` | |
| `CONSISTENCY_MINIMIZE_LATENCY_DESCRIPTION` | `consistency.minimize_latency.description` | |
| `CONSISTENCY_UNSPECIFIED_DESCRIPTION` | `consistency.unspecified.description` | |
| `DSL_INPUT_EMPTY` | `dsl.input_empty` | |
| `DSL_INVALID_COMPUTED_USERSET` | `dsl.invalid_computed_userset` | |
| `DSL_INVALID_COMPUTED_USERSET_RELATION` | `dsl.invalid_computed_userset_relation` | |
| `DSL_PARSE_FAILED` | `dsl.parse_failed` | |
| `DSL_PATTERN_EMPTY` | `dsl.pattern_empty` | |
| `DSL_UNBALANCED_PARENTHESES_CLOSING` | `dsl.unbalanced_parentheses_closing` | |
| `DSL_UNBALANCED_PARENTHESES_OPENING` | `dsl.unbalanced_parentheses_opening` | |
| `DSL_UNRECOGNIZED_TERM` | `dsl.unrecognized_term` | |
| `INVALID_BATCH_CHECK_EMPTY` | `validation.batch_check_empty` | |
| `INVALID_CORRELATION_ID` | `validation.invalid_correlation_id` | |
| `JWT_INVALID_AUDIENCE` | `auth.jwt.invalid_audience` | |
| `JWT_INVALID_FORMAT` | `auth.jwt.invalid_format` | |
| `JWT_INVALID_HEADER` | `auth.jwt.invalid_header` | |
| `JWT_INVALID_ISSUER` | `auth.jwt.invalid_issuer` | |
| `JWT_INVALID_PAYLOAD` | `auth.jwt.invalid_payload` | |
| `JWT_MISSING_REQUIRED_CLAIMS` | `auth.jwt.missing_required_claims` | |
| `JWT_TOKEN_EXPIRED` | `auth.jwt.token_expired` | |
| `JWT_TOKEN_NOT_YET_VALID` | `auth.jwt.token_not_yet_valid` | |
| `MODEL_DUPLICATE_TYPE` | `model.duplicate_type` | |
| `MODEL_INVALID_IDENTIFIER_FORMAT` | `model.invalid_identifier_format` | |
| `MODEL_INVALID_TUPLE_KEY` | `model.invalid_tuple_key` | |
| `MODEL_LEAF_MISSING_CONTENT` | `model.leaf_missing_content` | |
| `MODEL_NO_MODELS_IN_STORE` | `model.no_models_in_store` | |
| `MODEL_SOURCE_INFO_FILE_EMPTY` | `model.source_info_file_empty` | |
| `MODEL_TYPE_DEFINITIONS_EMPTY` | `model.type_definitions_empty` | |
| `MODEL_TYPED_WILDCARD_TYPE_EMPTY` | `model.typed_wildcard_type_empty` | |
| `NETWORK_ERROR` | `network.error` | |
| `NETWORK_ERROR_CONFLICT` | `exception.network.conflict` | |
| `NETWORK_ERROR_FORBIDDEN` | `exception.network.forbidden` | |
| `NETWORK_ERROR_INVALID` | `exception.network.invalid` | |
| `NETWORK_ERROR_REQUEST` | `exception.network.request` | |
| `NETWORK_ERROR_SERVER` | `exception.network.server` | |
| `NETWORK_ERROR_TIMEOUT` | `exception.network.timeout` | |
| `NETWORK_ERROR_UNAUTHENTICATED` | `exception.network.unauthenticated` | |
| `NETWORK_ERROR_UNDEFINED_ENDPOINT` | `exception.network.undefined_endpoint` | |
| `NETWORK_ERROR_UNEXPECTED` | `exception.network.unexpected` | |
| `NETWORK_UNEXPECTED_STATUS` | `network.unexpected_status` | |
| `NO_LAST_REQUEST_FOUND` | `client.no_last_request_found` | |
| `REQUEST_CONTINUATION_TOKEN_EMPTY` | `request.continuation_token_empty` | |
| `REQUEST_MODEL_ID_EMPTY` | `request.model_id_empty` | |
| `REQUEST_OBJECT_EMPTY` | `request.object_empty` | |
| `REQUEST_OBJECT_TYPE_EMPTY` | `request.object_type_empty` | |
| `REQUEST_PAGE_SIZE_INVALID` | `request.page_size_invalid` | |
| `REQUEST_RELATION_EMPTY` | `request.relation_empty` | |
| `REQUEST_STORE_ID_EMPTY` | `request.store_id_empty` | |
| `REQUEST_STORE_NAME_EMPTY` | `request.store_name_empty` | |
| `REQUEST_TRANSACTIONAL_LIMIT_EXCEEDED` | `request.transactional_limit_exceeded` | |
| `REQUEST_TYPE_EMPTY` | `request.type_empty` | |
| `REQUEST_USER_EMPTY` | `request.user_empty` | |
| `RESPONSE_UNEXPECTED_TYPE` | `response.unexpected_type` | |
| `RESULT_FAILURE_NO_VALUE` | `result.failure_no_value` | |
| `RESULT_SUCCESS_NO_ERROR` | `result.success_no_error` | |
| `SCHEMA_CLASS_NOT_FOUND` | `schema.class_not_found` | |
| `SCHEMA_ITEM_TYPE_NOT_FOUND` | `schema.item_type_not_found` | |
| `SERIALIZATION_ERROR_COULD_NOT_ADD_ITEMS` | `exception.serialization.could_not_add_items_to_collection` | |
| `SERIALIZATION_ERROR_EMPTY_COLLECTION` | `exception.serialization.empty_collection` | |
| `SERIALIZATION_ERROR_INVALID_ITEM_TYPE` | `exception.serialization.invalid_item_type` | |
| `SERIALIZATION_ERROR_MISSING_REQUIRED_PARAM` | `exception.serialization.missing_required_constructor_parameter` | |
| `SERIALIZATION_ERROR_RESPONSE` | `exception.serialization.response` | |
| `SERIALIZATION_ERROR_UNDEFINED_ITEM_TYPE` | `exception.serialization.undefined_item_type` | |
| `SERVICE_HTTP_NOT_AVAILABLE` | `service.http_not_available` | |
| `SERVICE_SCHEMA_VALIDATOR_NOT_AVAILABLE` | `service.schema_validator_not_available` | |
| `SERVICE_STORE_REPOSITORY_NOT_AVAILABLE` | `service.store_repository_not_available` | |
| `SERVICE_TUPLE_FILTER_NOT_AVAILABLE` | `service.tuple_filter_not_available` | |
| `SERVICE_TUPLE_REPOSITORY_NOT_AVAILABLE` | `service.tuple_repository_not_available` | |
| `STORE_NAME_REQUIRED` | `store.name_required` | |
| `STORE_NAME_TOO_LONG` | `store.name_too_long` | |
| `STORE_NOT_FOUND` | `store.not_found` | |
| `TRANSLATION_FILE_NOT_FOUND` | `translation.file_not_found` | |
| `TRANSLATION_UNSUPPORTED_FORMAT` | `translation.unsupported_format` | |
| `TUPLE_OPERATION_DELETE_DESCRIPTION` | `tuple_operation.delete.description` | |
| `TUPLE_OPERATION_WRITE_DESCRIPTION` | `tuple_operation.write.description` | |
| `YAML_CANNOT_READ_FILE` | `yaml.cannot_read_file` | |
| `YAML_FILE_DOES_NOT_EXIST` | `yaml.file_does_not_exist` | |
| `YAML_INVALID_STRUCTURE` | `yaml.invalid_structure` | |
| `YAML_INVALID_SYNTAX_EMPTY_KEY` | `yaml.invalid_syntax_empty_key` | |
| `YAML_INVALID_SYNTAX_MISSING_COLON` | `yaml.invalid_syntax_missing_colon` | |
| `YAML_INVALID_SYNTAX_MISSING_VALUE` | `yaml.invalid_syntax_missing_value` | |
#### Translation Tables
The following tables show all available translations for each message key used throughout the OpenFGA PHP SDK.
##### `assertions.empty_collection`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------- |
| German | Assertion-Sammlung darf nicht leer sein |
| English | Assertions collection cannot be empty |
| Spanish | La colección de aserciones no puede estar vacía |
| French | La collection d'assertions ne peut pas être vide |
| Italian | La collezione di asserzioni non può essere vuota |
| Japanese | アサーションコレクションを空にすることはできません |
| Korean | 어설션 컬렉션은 비어있을 수 없습니다 |
| Dutch | Assertieverzameling kan niet leeg zijn |
| Portuguese (Brazilian) | Coleção de assertions não pode estar vazia |
| Russian | Коллекция утверждений не может быть пустой |
| Swedish | Påståendesamling kan inte vara tom |
| Turkish | Onaylama koleksiyonu boş olamaz |
| Ukrainian | Колекція тверджень не може бути порожньою |
| Chinese (Simplified) | 断言集合不能为空 |
##### `assertions.invalid_tuple_key`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------------------------------------- |
| German | Assertion enthält ungültigen Tupel-Schlüssel: Benutzer, Relation und Objekt sind erforderlich |
| English | Assertion contains invalid tuple key: user, relation, and object are required |
| Spanish | La aserción contiene una clave de tupla inválida: se requieren usuario, relación y objeto |
| French | L'assertion contient une clé de tuple invalide : utilisateur, relation et objet sont requis |
| Italian | L''asserzione contiene una chiave tupla non valida: utente, relazione e oggetto sono obbligatori |
| Japanese | アサーションに無効なタプルキーが含まれています: ユーザー、関係、オブジェクトが必須です |
| Korean | 어설션에 잘못된 튜플 키가 포함되어 있습니다: 사용자, 관계, 객체가 필요합니다 |
| Dutch | Assertie bevat ongeldige tuple-sleutel: gebruiker, relatie en object zijn vereist |
| Portuguese (Brazilian) | Assertion contém chave de tupla inválida: usuário, relação e objeto são obrigatórios |
| Russian | Утверждение содержит недопустимый ключ кортежа: требуются пользователь, отношение и объект |
| Swedish | Påstående innehåller ogiltig tupel-nyckel: användare, relation och objekt krävs |
| Turkish | Onaylama geçersiz tuple anahtarı içeriyor: kullanıcı, ilişki ve nesne gerekli |
| Ukrainian | Твердження містить недійсний ключ кортежу: потрібні користувач, відношення та об'єкт |
| Chinese (Simplified) | 断言包含无效的元组键:用户、关系和对象是必需的 |
##### `auth.access_token_must_be_string`
| Locale | Translation |
| ---------------------- | ---------------------------------------- |
| German | access_token muss eine Zeichenkette sein |
| English | access_token must be a string |
| Spanish | access_token debe ser una cadena |
| French | access_token doit être une chaîne |
| Italian | access_token deve essere una stringa |
| Japanese | access_tokenは文字列である必要があります |
| Korean | access_token은 문자열이어야 합니다 |
| Dutch | access_token moet een string zijn |
| Portuguese (Brazilian) | access_token deve ser uma string |
| Russian | access_token должен быть строкой |
| Swedish | access_token måste vara en sträng |
| Turkish | access_token bir dize olmalıdır |
| Ukrainian | access_token має бути рядком |
| Chinese (Simplified) | access_token必须是字符串 |
##### `exception.auth.token_expired`
| Locale | Translation |
| ---------------------- | ----------------------------------------- |
| German | Authentifizierungstoken ist abgelaufen |
| English | Authentication token has expired |
| Spanish | El token de autenticación ha expirado |
| French | Le jeton d'authentification a expiré |
| Italian | Il token di autenticazione è scaduto |
| Japanese | 認証トークンの有効期限が切れました |
| Korean | 인증 토큰이 만료되었습니다 |
| Dutch | Authenticatietoken is verlopen |
| Portuguese (Brazilian) | Token de autenticação expirou |
| Russian | Токен аутентификации истек |
| Swedish | Autentiseringstoken har gått ut |
| Turkish | Kimlik doğrulama tokeni süresi doldu |
| Ukrainian | Токен автентифікації закінчився |
| Chinese (Simplified) | 身份验证令牌已过期 |
##### `exception.auth.token_invalid`
| Locale | Translation |
| ---------------------- | --------------------------------------------- |
| German | Authentifizierungstoken ist ungültig |
| English | Authentication token is invalid |
| Spanish | El token de autenticación es inválido |
| French | Le jeton d'authentification est invalide |
| Italian | Il token di autenticazione non è valido |
| Japanese | 認証トークンが無効です |
| Korean | 인증 토큰이 잘못되었습니다 |
| Dutch | Authenticatietoken is ongeldig |
| Portuguese (Brazilian) | Token de autenticação é inválido |
| Russian | Токен аутентификации недействителен |
| Swedish | Autentiseringstoken är ogiltig |
| Turkish | Kimlik doğrulama tokeni geçersiz |
| Ukrainian | Токен автентифікації недійсний |
| Chinese (Simplified) | 身份验证令牌无效 |
##### `auth.expires_in_must_be_integer`
| Locale | Translation |
| ---------------------- | --------------------------------------- |
| German | expires_in muss eine Ganzzahl sein |
| English | expires_in must be an integer |
| Spanish | expires_in debe ser un entero |
| French | expires_in doit être un entier |
| Italian | expires_in deve essere un numero intero |
| Japanese | expires_inは整数である必要があります |
| Korean | expires_in은 정수여야 합니다 |
| Dutch | expires_in moet een geheel getal zijn |
| Portuguese (Brazilian) | expires_in deve ser um inteiro |
| Russian | expires_in должен быть целым числом |
| Swedish | expires_in måste vara ett heltal |
| Turkish | expires_in bir tamsayı olmalıdır |
| Ukrainian | expires_in має бути цілим числом |
| Chinese (Simplified) | expires_in必须是整数 |
##### `auth.invalid_response_format`
| Locale | Translation |
| ---------------------- | ------------------------------ |
| German | Ungültiges Antwortformat |
| English | Invalid response format |
| Spanish | Formato de respuesta inválido |
| French | Format de réponse invalide |
| Italian | Formato di risposta non valido |
| Japanese | 無効なレスポンス形式です |
| Korean | 잘못된 응답 형식 |
| Dutch | Ongeldig responsformaat |
| Portuguese (Brazilian) | Formato de resposta inválido |
| Russian | Недопустимый формат ответа |
| Swedish | Ogiltigt svarsformat |
| Turkish | Geçersiz yanıt formatı |
| Ukrainian | Недійсний формат відповіді |
| Chinese (Simplified) | 无效的响应格式 |
##### `auth.missing_required_fields`
| Locale | Translation |
| ---------------------- | --------------------------------------------- |
| German | Erforderliche Felder in der Antwort fehlen |
| English | Missing required fields in response |
| Spanish | Faltan campos requeridos en la respuesta |
| French | Champs obligatoires manquants dans la réponse |
| Italian | Campi obbligatori mancanti nella risposta |
| Japanese | レスポンスに必須フィールドがありません |
| Korean | 응답에 필수 필드가 누락되었습니다 |
| Dutch | Ontbrekende vereiste velden in respons |
| Portuguese (Brazilian) | Campos obrigatórios faltando na resposta |
| Russian | Отсутствуют обязательные поля в ответе |
| Swedish | Saknade obligatoriska fält i svar |
| Turkish | Yanıtta gerekli alanlar eksik |
| Ukrainian | Відсутні обов'язкові поля у відповіді |
| Chinese (Simplified) | 响应中缺少必需字段 |
##### `auth.user_message.token_expired`
| Locale | Translation |
| ---------------------- | -------------------------------------------------------------- |
| German | Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an. |
| English | Your session has expired. Please sign in again. |
| Spanish | Su sesión ha expirado. Por favor, inicie sesión nuevamente. |
| French | Votre session a expiré. Veuillez vous reconnecter. |
| Italian | La tua sessione è scaduta. Per favore, accedi di nuovo. |
| Japanese | セッションの有効期限が切れました。再度サインインしてください。 |
| Korean | 세션이 만료되었습니다. 다시 로그인해 주세요. |
| Dutch | Uw sessie is verlopen. Log opnieuw in. |
| Portuguese (Brazilian) | Sua sessão expirou. Por favor, faça login novamente. |
| Russian | Ваша сессия истекла. Пожалуйста, войдите снова. |
| Swedish | Din session har gått ut. Vänligen logga in igen. |
| Turkish | Oturumunuzun süresi doldu. Lütfen tekrar giriş yapın. |
| Ukrainian | Ваша сесія закінчилася. Будь ласка, увійдіть знову. |
| Chinese (Simplified) | 您的会话已过期,请重新登录。 |
##### `auth.user_message.token_invalid`
| Locale | Translation |
| ---------------------- | --------------------------------------------------------- |
| German | Ungültige Authentifizierungsdaten bereitgestellt. |
| English | Invalid authentication credentials provided. |
| Spanish | Credenciales de autenticación inválidas proporcionadas. |
| French | Identifiants d'authentification invalides fournis. |
| Italian | Credenziali di autenticazione non valide fornite. |
| Japanese | 無効な認証資格情報が提供されました。 |
| Korean | 잘못된 인증 자격 증명이 제공되었습니다. |
| Dutch | Ongeldige authenticatiegegevens verstrekt. |
| Portuguese (Brazilian) | Credenciais de autenticação inválidas fornecidas. |
| Russian | Предоставлены недопустимые учетные данные аутентификации. |
| Swedish | Ogiltiga autentiseringsuppgifter tillhandahållna. |
| Turkish | Geçersiz kimlik doğrulama bilgileri sağlandı. |
| Ukrainian | Надано недійсні облікові дані автентифікації. |
| Chinese (Simplified) | 提供的身份验证凭据无效。 |
##### `validation.batch_tuple_chunk_size_exceeded`
| Locale | Translation |
| ---------------------- | --------------------------------------------------- |
| German | Chunk-Größe darf %max_size% nicht überschreiten |
| English | Chunk size cannot exceed %max_size% |
| Spanish | El tamaño del fragmento no puede exceder %max_size% |
| French | La taille du bloc ne peut pas dépasser %max_size% |
| Italian | La dimensione del chunk non può superare %max_size% |
| Japanese | チャンクサイズは%max_size%を超えることはできません |
| Korean | 청크 크기는 %max_size%를 초과할 수 없습니다 |
| Dutch | Chunkgrootte kan %max_size% niet overschrijden |
| Portuguese (Brazilian) | Tamanho do chunk não pode exceder %max_size% |
| Russian | Размер блока не может превышать %max_size% |
| Swedish | Chunkstorlek kan inte överstiga %max_size% |
| Turkish | Parça boyutu %max_size% değerini aşamaz |
| Ukrainian | Розмір блоку не може перевищувати %max_size% |
| Chinese (Simplified) | 块大小不能超过%max_size% |
##### `validation.batch_tuple_chunk_size_positive`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------- |
| German | Chunk-Größe muss eine positive Ganzzahl sein |
| English | Chunk size must be a positive integer |
| Spanish | El tamaño del fragmento debe ser un entero positivo |
| French | La taille du bloc doit être un entier positif |
| Italian | La dimensione del chunk deve essere un numero intero positivo |
| Japanese | チャンクサイズは正の整数である必要があります |
| Korean | 청크 크기는 양의 정수여야 합니다 |
| Dutch | Chunkgrootte moet een positief geheel getal zijn |
| Portuguese (Brazilian) | Tamanho do chunk deve ser um inteiro positivo |
| Russian | Размер блока должен быть положительным целым числом |
| Swedish | Chunkstorlek måste vara ett positivt heltal |
| Turkish | Parça boyutu pozitif bir tamsayı olmalıdır |
| Ukrainian | Розмір блоку має бути додатним цілим числом |
| Chinese (Simplified) | 块大小必须是正整数 |
##### `exception.client.authentication`
| Locale | Translation |
| ---------------------- | ------------------------------------------- |
| German | Authentifizierungsfehler aufgetreten |
| English | Authentication error occurred |
| Spanish | Error de autenticación |
| French | Erreur d'authentification survenue |
| Italian | Si è verificato un errore di autenticazione |
| Japanese | 認証エラーが発生しました |
| Korean | 인증 오류가 발생했습니다 |
| Dutch | Authenticatiefout opgetreden |
| Portuguese (Brazilian) | Erro de autenticação ocorreu |
| Russian | Произошла ошибка аутентификации |
| Swedish | Autentiseringsfel inträffade |
| Turkish | Kimlik doğrulama hatası oluştu |
| Ukrainian | Сталася помилка автентифікації |
| Chinese (Simplified) | 发生身份验证错误 |
##### `exception.client.configuration`
| Locale | Translation |
| ---------------------- | --------------------------------- |
| German | Konfigurationsfehler erkannt |
| English | Configuration error detected |
| Spanish | Error de configuración detectado |
| French | Erreur de configuration détectée |
| Italian | Rilevato errore di configurazione |
| Japanese | 設定エラーが検出されました |
| Korean | 구성 오류가 감지되었습니다 |
| Dutch | Configuratiefout gedetecteerd |
| Portuguese (Brazilian) | Erro de configuração detectado |
| Russian | Обнаружена ошибка конфигурации |
| Swedish | Konfigurationsfel upptäckt |
| Turkish | Yapılandırma hatası tespit edildi |
| Ukrainian | Виявлено помилку конфігурації |
| Chinese (Simplified) | 检测到配置错误 |
##### `exception.client.network`
| Locale | Translation |
| ---------------------- | --------------------------------- |
| German | Netzwerkkommunikationsfehler |
| English | Network communication error |
| Spanish | Error de comunicación de red |
| French | Erreur de communication réseau |
| Italian | Errore di comunicazione di rete |
| Japanese | ネットワーク通信エラー |
| Korean | 네트워크 통신 오류 |
| Dutch | Netwerkcommunicatiefout |
| Portuguese (Brazilian) | Erro de comunicação de rede |
| Russian | Ошибка сетевого соединения |
| Swedish | Nätverkskommunikationsfel |
| Turkish | Ağ iletişim hatası |
| Ukrainian | Помилка мережевого з'єднання |
| Chinese (Simplified) | 网络通信错误 |
##### `exception.client.serialization`
| Locale | Translation |
| ---------------------- | ----------------------------------- |
| German | Datenserialisierungsfehler |
| English | Data serialization error |
| Spanish | Error de serialización de datos |
| French | Erreur de sérialisation des données |
| Italian | Errore di serializzazione dati |
| Japanese | データシリアライゼーションエラー |
| Korean | 데이터 직렬화 오류 |
| Dutch | Data serialisatiefout |
| Portuguese (Brazilian) | Erro de serialização de dados |
| Russian | Ошибка сериализации данных |
| Swedish | Dataserialiseringsfel |
| Turkish | Veri serileştirme hatası |
| Ukrainian | Помилка серіалізації даних |
| Chinese (Simplified) | 数据序列化错误 |
##### `exception.client.validation`
| Locale | Translation |
| ---------------------- | ------------------------------------ |
| German | Anfragvalidierung fehlgeschlagen |
| English | Request validation failed |
| Spanish | La validación de la solicitud falló |
| French | Échec de la validation de la requête |
| Italian | Validazione della richiesta fallita |
| Japanese | リクエストの検証に失敗しました |
| Korean | 요청 검증에 실패했습니다 |
| Dutch | Verzoekvalidatie mislukt |
| Portuguese (Brazilian) | Validação de requisição falhou |
| Russian | Проверка запроса не удалась |
| Swedish | Begäranvalidering misslyckades |
| Turkish | İstek doğrulaması başarısız |
| Ukrainian | Перевірка запиту не вдалася |
| Chinese (Simplified) | 请求验证失败 |
##### `collection.invalid_item_instance`
| Locale | Translation |
| ---------------------- | --------------------------------------------------------------- |
| German | Erwartete Instanz von %expected%, %given% gegeben |
| English | Expected instance of %expected%, %given% given |
| Spanish | Se esperaba una instancia de %expected%, se proporcionó %given% |
| French | Instance attendue de %expected%, %given% donné |
| Italian | Attesa istanza di %expected%, fornito %given% |
| Japanese | %expected%のインスタンスが期待されます。%given%が提供されました |
| Korean | %expected%의 인스턴스가 예상됩니다. %given%이 제공되었습니다 |
| Dutch | Verwacht instantie van %expected%, %given% gegeven |
| Portuguese (Brazilian) | Esperada instância de %expected%, %given% fornecido |
| Russian | Ожидается экземпляр %expected%, предоставлено %given% |
| Swedish | Förväntad instans av %expected%, %given% given |
| Turkish | %expected% örneği bekleniyor, %given% verildi |
| Ukrainian | Очікується екземпляр %expected%, надано %given% |
| Chinese (Simplified) | 期望%expected%的实例,提供了%given% |
##### `collection.invalid_item_type_interface`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------------- |
| German | Erwarteter Elementtyp sollte %interface% implementieren, %given% gegeben |
| English | Expected item type to implement %interface%, %given% given |
| Spanish | Se esperaba que el tipo de elemento implemente %interface%, se proporcionó %given% |
| French | Type d'élément attendu pour implémenter %interface%, %given% donné |
| Italian | Il tipo di elemento dovrebbe implementare %interface%, fornito %given% |
| Japanese | アイテムタイプは%interface%を実装する必要があります。%given%が提供されました |
| Korean | 항목 타입이 %interface%를 구현해야 합니다. %given%이 제공되었습니다 |
| Dutch | Verwacht itemtype om %interface% te implementeren, %given% gegeven |
| Portuguese (Brazilian) | Esperado tipo de item para implementar %interface%, %given% fornecido |
| Russian | Ожидается, что тип элемента реализует %interface%, предоставлено %given% |
| Swedish | Förväntad objekttyp att implementera %interface%, %given% given |
| Turkish | Öğe türünün %interface% uygulaması bekleniyor, %given% verildi |
| Ukrainian | Очікується, що тип елемента реалізує %interface%, надано %given% |
| Chinese (Simplified) | 期望项目类型实现%interface%,提供了%given% |
##### `collection.invalid_key_type`
| Locale | Translation |
| ---------------------- | --------------------------------------------------------------------- |
| German | Ungültiger Schlüsseltyp; Zeichenkette erwartet, %given% gegeben. |
| English | Invalid key type; expected string, %given% given. |
| Spanish | Tipo de clave inválido; se esperaba cadena, se proporcionó %given%. |
| French | Type de clé invalide ; chaîne attendue, %given% donné. |
| Italian | Tipo di chiave non valido; attesa stringa, fornito %given%. |
| Japanese | 無効なキータイプです。文字列が期待されます。%given%が提供されました。 |
| Korean | 잘못된 키 타입; 문자열이 예상됩니다. %given%이 제공되었습니다. |
| Dutch | Ongeldig sleuteltype; verwacht string, %given% gegeven. |
| Portuguese (Brazilian) | Tipo de chave inválido; esperada string, %given% fornecido. |
| Russian | Недопустимый тип ключа; ожидается строка, предоставлено %given%. |
| Swedish | Ogiltig nyckeltyp; förväntad sträng, %given% given. |
| Turkish | Geçersiz anahtar türü; dize bekleniyor, %given% verildi. |
| Ukrainian | Недійсний тип ключа; очікується рядок, надано %given%. |
| Chinese (Simplified) | 无效的键类型;期望字符串,提供了%given%。 |
##### `collection.invalid_position`
| Locale | Translation |
| ---------------------- | -------------------- |
| German | Ungültige Position |
| English | Invalid position |
| Spanish | Posición inválida |
| French | Position invalide |
| Italian | Posizione non valida |
| Japanese | 無効な位置です |
| Korean | 잘못된 위치 |
| Dutch | Ongeldige positie |
| Portuguese (Brazilian) | Posição inválida |
| Russian | Недопустимая позиция |
| Swedish | Ogiltig position |
| Turkish | Geçersiz konum |
| Ukrainian | Недійсна позиція |
| Chinese (Simplified) | 无效的位置 |
##### `collection.invalid_value_type`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------- |
| German | Erwartete Instanz von %expected%, %given% gegeben. |
| English | Expected instance of %expected%, %given% given. |
| Spanish | Se esperaba una instancia de %expected%, se proporcionó %given%. |
| French | Instance attendue de %expected%, %given% donné. |
| Italian | Attesa istanza di %expected%, fornito %given%. |
| Japanese | %expected%のインスタンスが期待されます。%given%が提供されました。 |
| Korean | %expected%의 인스턴스가 예상됩니다. %given%이 제공되었습니다. |
| Dutch | Verwacht instantie van %expected%, %given% gegeven. |
| Portuguese (Brazilian) | Esperada instância de %expected%, %given% fornecido. |
| Russian | Ожидается экземпляр %expected%, предоставлено %given%. |
| Swedish | Förväntad instans av %expected%, %given% given. |
| Turkish | %expected% örneği bekleniyor, %given% verildi. |
| Ukrainian | Очікується екземпляр %expected%, надано %given%. |
| Chinese (Simplified) | 期望%expected%的实例,提供了%given%。 |
##### `collection.key_must_be_string`
| Locale | Translation |
| ---------------------- | -------------------------------------- |
| German | Schlüssel muss eine Zeichenkette sein. |
| English | Key must be a string. |
| Spanish | La clave debe ser una cadena. |
| French | La clé doit être une chaîne. |
| Italian | La chiave deve essere una stringa. |
| Japanese | キーは文字列である必要があります。 |
| Korean | 키는 문자열이어야 합니다. |
| Dutch | Sleutel moet een string zijn. |
| Portuguese (Brazilian) | Chave deve ser uma string. |
| Russian | Ключ должен быть строкой. |
| Swedish | Nyckel måste vara en sträng. |
| Turkish | Anahtar bir dize olmalıdır. |
| Ukrainian | Ключ має бути рядком. |
| Chinese (Simplified) | 键必须是字符串。 |
##### `collection.undefined_item_type`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| German | Undefinierter Elementtyp für %class%. Definieren Sie die $itemType-Eigenschaft oder überschreiben Sie den Konstruktor. |
| English | Undefined item type for %class%. Define the $itemType property or override the constructor. |
| Spanish | Tipo de elemento indefinido para %class%. Define la propiedad $itemType o sobrescribe el constructor. |
| French | Type d'élément non défini pour %class%. Définissez la propriété $itemType ou surchargez le constructeur. |
| Italian | Tipo di elemento non definito per %class%. Definire la proprietà $itemType o sovrascrivere il costruttore. |
| Japanese | %class%のアイテムタイプが未定義です。$itemTypeプロパティを定義するかコンストラクターをオーバーライドしてください。 |
| Korean | %class%의 항목 타입이 정의되지 않았습니다. $itemType 속성을 정의하거나 생성자를 재정의하세요. |
| Dutch | Ongedefinieerd itemtype voor %class%. Definieer de $itemType eigenschap of overschrijf de constructor. |
| Portuguese (Brazilian) | Tipo de item indefinido para %class%. Defina a propriedade $itemType ou sobrescreva o construtor. |
| Russian | Неопределенный тип элемента для %class%. Определите свойство $itemType или переопределите конструктор. |
| Swedish | Odefinierad objekttyp för %class%. Definiera $itemType-egenskapen eller åsidosätt konstruktorn. |
| Turkish | %class% için tanımlanmamış öğe türü. $itemType özelliğini tanımlayın veya yapıcıyı geçersiz kılın. |
| Ukrainian | Невизначений тип елемента для %class%. Визначте властивість $itemType або перевизначте конструктор. |
| Chinese (Simplified) | %class%的项目类型未定义。请定义$itemType属性或覆盖构造函数。 |
##### `exception.config.http_client_missing`
| Locale | Translation |
| ---------------------- | --------------------------------------- |
| German | HTTP-Client ist nicht konfiguriert |
| English | HTTP client is not configured |
| Spanish | El cliente HTTP no está configurado |
| French | Le client HTTP n'est pas configuré |
| Italian | Client HTTP non configurato |
| Japanese | HTTPクライアントが設定されていません |
| Korean | HTTP 클라이언트가 구성되지 않았습니다 |
| Dutch | HTTP-client is niet geconfigureerd |
| Portuguese (Brazilian) | Cliente HTTP não está configurado |
| Russian | HTTP клиент не настроен |
| Swedish | HTTP-klient är inte konfigurerad |
| Turkish | HTTP istemci yapılandırılmamış |
| Ukrainian | HTTP клієнт не налаштований |
| Chinese (Simplified) | HTTP客户端未配置 |
##### `exception.config.http_request_factory_missing`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------ |
| German | HTTP-Request-Factory ist nicht konfiguriert |
| English | HTTP request factory is not configured |
| Spanish | La fábrica de solicitudes HTTP no está configurada |
| French | La fabrique de requêtes HTTP n'est pas configurée |
| Italian | Factory delle richieste HTTP non configurata |
| Japanese | HTTPリクエストファクトリが設定されていません |
| Korean | HTTP 요청 팩토리가 구성되지 않았습니다 |
| Dutch | HTTP-verzoek factory is niet geconfigureerd |
| Portuguese (Brazilian) | Factory de requisição HTTP não está configurada |
| Russian | Фабрика HTTP запросов не настроена |
| Swedish | HTTP-begäranfabrik är inte konfigurerad |
| Turkish | HTTP istek fabrikası yapılandırılmamış |
| Ukrainian | Фабрика HTTP запитів не налаштована |
| Chinese (Simplified) | HTTP请求工厂未配置 |
##### `exception.config.http_response_factory_missing`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------ |
| German | HTTP-Response-Factory ist nicht konfiguriert |
| English | HTTP response factory is not configured |
| Spanish | La fábrica de respuestas HTTP no está configurada |
| French | La fabrique de réponses HTTP n'est pas configurée |
| Italian | Factory delle risposte HTTP non configurata |
| Japanese | HTTPレスポンスファクトリが設定されていません |
| Korean | HTTP 응답 팩토리가 구성되지 않았습니다 |
| Dutch | HTTP-respons factory is niet geconfigureerd |
| Portuguese (Brazilian) | Factory de resposta HTTP não está configurada |
| Russian | Фабрика HTTP ответов не настроена |
| Swedish | HTTP-svarsfabrik är inte konfigurerad |
| Turkish | HTTP yanıt fabrikası yapılandırılmamış |
| Ukrainian | Фабрика HTTP відповідей не налаштована |
| Chinese (Simplified) | HTTP响应工厂未配置 |
##### `exception.config.http_stream_factory_missing`
| Locale | Translation |
| ---------------------- | -------------------------------------------------- |
| German | HTTP-Stream-Factory ist nicht konfiguriert |
| English | HTTP stream factory is not configured |
| Spanish | La fábrica de streams HTTP no está configurada |
| French | La fabrique de flux HTTP n'est pas configurée |
| Italian | Factory degli stream HTTP non configurata |
| Japanese | HTTPストリームファクトリが設定されていません |
| Korean | HTTP 스트림 팩토리가 구성되지 않았습니다 |
| Dutch | HTTP-stream factory is niet geconfigureerd |
| Portuguese (Brazilian) | Factory de stream HTTP não está configurada |
| Russian | Фабрика HTTP потоков не настроена |
| Swedish | HTTP-strömfabrik är inte konfigurerad |
| Turkish | HTTP akış fabrikası yapılandırılmamış |
| Ukrainian | Фабрика HTTP потоків не налаштована |
| Chinese (Simplified) | HTTP流工厂未配置 |
##### `exception.config.invalid_language`
| Locale | Translation |
| ---------------------- | --------------------------------------------------- |
| German | Ungültiger Sprachcode bereitgestellt: %language% |
| English | Invalid language code provided: %language% |
| Spanish | Código de idioma inválido proporcionado: %language% |
| French | Code de langue invalide fourni : %language% |
| Italian | Codice lingua non valido fornito: %language% |
| Japanese | 無効な言語コードが提供されました: %language% |
| Korean | 잘못된 언어 코드가 제공되었습니다: %language% |
| Dutch | Ongeldige taalcode verstrekt: %language% |
| Portuguese (Brazilian) | Código de idioma inválido fornecido: %language% |
| Russian | Предоставлен недопустимый код языка: %language% |
| Swedish | Ogiltig språkkod tillhandahållen: %language% |
| Turkish | Geçersiz dil kodu sağlandı: %language% |
| Ukrainian | Надано недійсний код мови: %language% |
| Chinese (Simplified) | 提供的语言代码无效:%language% |
##### `exception.config.invalid_retry_count`
| Locale | Translation |
| ---------------------- | --------------------------------------------------------- |
| German | Ungültige Wiederholungsanzahl bereitgestellt: %retries% |
| English | Invalid retry count provided: %retries% |
| Spanish | Número de reintentos inválido proporcionado: %retries% |
| French | Nombre de tentatives invalide fourni : %retries% |
| Italian | Numero di tentativi non valido fornito: %retries% |
| Japanese | 無効な再試行回数が提供されました: %retries% |
| Korean | 잘못된 재시도 횟수가 제공되었습니다: %retries% |
| Dutch | Ongeldig aantal herhalingen verstrekt: %retries% |
| Portuguese (Brazilian) | Contagem de tentativas inválida fornecida: %retries% |
| Russian | Предоставлено недопустимое количество повторов: %retries% |
| Swedish | Ogiltigt antal återförsök tillhandahållet: %retries% |
| Turkish | Geçersiz yeniden deneme sayısı sağlandı: %retries% |
| Ukrainian | Надано недійсну кількість повторів: %retries% |
| Chinese (Simplified) | 提供的重试次数无效:%retries% |
##### `exception.config.invalid_url`
| Locale | Translation |
| ---------------------- | ------------------------------------ |
| German | Ungültige URL bereitgestellt: %url% |
| English | Invalid URL provided: %url% |
| Spanish | URL inválida proporcionada: %url% |
| French | URL invalide fournie : %url% |
| Italian | URL non valido fornito: %url% |
| Japanese | 無効なURLが提供されました: %url% |
| Korean | 잘못된 URL이 제공되었습니다: %url% |
| Dutch | Ongeldige URL verstrekt: %url% |
| Portuguese (Brazilian) | URL inválida fornecida: %url% |
| Russian | Предоставлен недопустимый URL: %url% |
| Swedish | Ogiltig URL tillhandahållen: %url% |
| Turkish | Geçersiz URL sağlandı: %url% |
| Ukrainian | Надано недійсний URL: %url% |
| Chinese (Simplified) | 提供的URL无效:%url% |
##### `consistency.higher_consistency.description`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| German | Priorisiert Datenkonsistenz über Abfrageleistung und gewährleistet die aktuellsten Ergebnisse |
| English | Prioritizes data consistency over query performance, ensuring the most up-to-date results |
| Spanish | Prioriza la consistencia de datos sobre el rendimiento de consultas, asegurando los resultados más actualizados |
| French | Privilégie la cohérence des données par rapport aux performances de requête, garantissant les résultats les plus récents |
| Italian | Prioritizza la coerenza dei dati rispetto alle prestazioni delle query, garantendo i risultati più aggiornati |
| Japanese | クエリパフォーマンスよりもデータ整合性を優先し、最新の結果を保証します |
| Korean | 쿼리 성능보다 데이터 일관성을 우선시하여 가장 최신 결과를 보장합니다 |
| Dutch | Geeft prioriteit aan dataconsistentie boven queryprestaties, zorgt voor de meest actuele resultaten |
| Portuguese (Brazilian) | Prioriza consistência de dados sobre performance de consulta, garantindo resultados mais atualizados |
| Russian | Приоритизирует согласованность данных над производительностью запросов, обеспечивая самые актуальные результаты |
| Swedish | Prioriterar datakonsistens över frågeprestanda, säkerställer de mest uppdaterade resultaten |
| Turkish | Sorgu performansından ziyade veri tutarlılığını önceleyerek en güncel sonuçları sağlar |
| Ukrainian | Пріоритизує узгодженість даних над продуктивністю запитів, забезпечуючи найновіші результати |
| Chinese (Simplified) | 优先考虑数据一致性而非查询性能,确保最新的结果 |
##### `consistency.minimize_latency.description`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| German | Priorisiert Abfrageleistung über Datenkonsistenz, verwendet möglicherweise leicht veraltete Daten |
| English | Prioritizes query performance over data consistency, potentially using slightly stale data |
| Spanish | Prioriza el rendimiento de consultas sobre la consistencia de datos, potencialmente usando datos ligeramente obsoletos |
| French | Privilégie les performances de requête par rapport à la cohérence des données, utilisant potentiellement des données légèrement obsolètes |
| Italian | Prioritizza le prestazioni delle query rispetto alla coerenza dei dati, potenzialmente utilizzando dati leggermente obsoleti |
| Japanese | データ整合性よりもクエリパフォーマンスを優先し、わずかに古いデータを使用する可能性があります |
| Korean | 데이터 일관성보다 쿼리 성능을 우선시하여 약간 오래된 데이터를 사용할 수 있습니다 |
| Dutch | Geeft prioriteit aan queryprestaties boven dataconsistentie, mogelijk met gebruik van enigszins verouderde data |
| Portuguese (Brazilian) | Prioriza performance de consulta sobre consistência de dados, potencialmente usando dados ligeiramente desatualizados |
| Russian | Приоритизирует производительность запросов над согласованностью данных, потенциально используя слегка устаревшие данные |
| Swedish | Prioriterar frågeprestanda över datakonsistens, potentiellt använder något föråldrad data |
| Turkish | Veri tutarlılığından ziyade sorgu performansını önceleyerek potansiyel olarak biraz eski veri kullanır |
| Ukrainian | Пріоритизує продуктивність запитів над узгодженістю даних, потенційно використовуючи дещо застарілі дані |
| Chinese (Simplified) | 优先考虑查询性能而非数据一致性,可能使用稍旧的数据 |
##### `consistency.unspecified.description`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------------------- |
| German | Verwendet die Standard-Konsistenzebene, die durch die OpenFGA-Serverkonfiguration bestimmt wird |
| English | Uses the default consistency level determined by the OpenFGA server configuration |
| Spanish | Usa el nivel de consistencia predeterminado determinado por la configuración del servidor OpenFGA |
| French | Utilise le niveau de cohérence par défaut déterminé par la configuration du serveur OpenFGA |
| Italian | Utilizza il livello di coerenza predefinito determinato dalla configurazione del server OpenFGA |
| Japanese | OpenFGAサーバー設定によって決定されるデフォルトの整合性レベルを使用します |
| Korean | OpenFGA 서버 구성에 의해 결정되는 기본 일관성 수준을 사용합니다 |
| Dutch | Gebruikt het standaard consistentieniveau bepaald door de OpenFGA-serverconfiguratie |
| Portuguese (Brazilian) | Usa o nível de consistência padrão determinado pela configuração do servidor OpenFGA |
| Russian | Использует уровень согласованности по умолчанию, определяемый конфигурацией сервера OpenFGA |
| Swedish | Använder standardkonsistensnivån som bestäms av OpenFGA-serverkonfigurationen |
| Turkish | OpenFGA sunucu yapılandırması tarafından belirlenen varsayılan tutarlılık seviyesini kullanır |
| Ukrainian | Використовує рівень узгодженості за замовчуванням, визначений конфігурацією сервера OpenFGA |
| Chinese (Simplified) | 使用由OpenFGA服务器配置确定的默认一致性级别 |
##### `dsl.input_empty`
| Locale | Translation |
| ---------------------- | --------------------------------------------- |
| German | Eingabezeichenkette darf nicht leer sein |
| English | Input string cannot be empty |
| Spanish | La cadena de entrada no puede estar vacía |
| French | La chaîne d'entrée ne peut pas être vide |
| Italian | La stringa di input non può essere vuota |
| Japanese | 入力文字列を空にすることはできません |
| Korean | 입력 문자열은 비어있을 수 없습니다 |
| Dutch | Invoerstring kan niet leeg zijn |
| Portuguese (Brazilian) | String de entrada não pode estar vazia |
| Russian | Строка ввода не может быть пустой |
| Swedish | Inmatningssträngen kan inte vara tom |
| Turkish | Giriş dizesi boş olamaz |
| Ukrainian | Рядок введення не може бути порожнім |
| Chinese (Simplified) | 输入字符串不能为空 |
##### `dsl.invalid_computed_userset`
| Locale | Translation |
| ---------------------- | --------------------------------------------- |
| German | Ungültiges berechnetes Benutzerset |
| English | Invalid computed userset |
| Spanish | Conjunto de usuarios calculado inválido |
| French | Ensemble d'utilisateurs calculé invalide |
| Italian | Set di utenti calcolato non valido |
| Japanese | 無効な計算済みユーザーセットです |
| Korean | 잘못된 계산된 사용자 집합 |
| Dutch | Ongeldige berekende gebruikersset |
| Portuguese (Brazilian) | Conjunto de usuários computado inválido |
| Russian | Недопустимый вычисленный набор пользователей |
| Swedish | Ogiltig beräknad användaruppsättning |
| Turkish | Geçersiz hesaplanmış kullanıcı kümesi |
| Ukrainian | Недійсний обчислений набір користувачів |
| Chinese (Simplified) | 无效的计算用户集 |
##### `dsl.invalid_computed_userset_relation`
| Locale | Translation |
| ---------------------- | --------------------------------------------------------------------------------- |
| German | Berechnete Benutzerset-Relation darf nicht leer sein. |
| English | Computed userset relation cannot be empty. |
| Spanish | La relación del userset computado no puede estar vacía. |
| French | La relation de l'ensemble d'utilisateurs calculé ne peut pas être vide. |
| Italian | La relazione del set di utenti calcolato non può essere vuota. |
| Japanese | 計算済みユーザーセットの関係を空にすることはできません。 |
| Korean | 계산된 사용자 집합 관계는 비어있을 수 없습니다. |
| Dutch | Berekende gebruikersset relatie kan niet leeg zijn. |
| Portuguese (Brazilian) | Relação do conjunto de usuários computado não pode estar vazia. |
| Russian | Отношение вычисленного набора пользователей не может быть пустым. |
| Swedish | Beräknad användaruppsättnings relation kan inte vara tom. |
| Turkish | Hesaplanmış kullanıcı kümesi ilişkisi boş olamaz. |
| Ukrainian | Відношення обчисленого набору користувачів не може бути порожнім. |
| Chinese (Simplified) | 计算用户集关系不能为空。 |
##### `dsl.parse_failed`
| Locale | Translation |
| ---------------------- | --------------------------------------------- |
| German | DSL-Eingabe konnte nicht geparst werden |
| English | Failed to parse DSL input |
| Spanish | No se pudo analizar la entrada DSL |
| French | Échec de l'analyse de l'entrée DSL |
| Italian | Impossibile analizzare l''input DSL |
| Japanese | DSL入力の解析に失敗しました |
| Korean | DSL 입력 구문분석에 실패했습니다 |
| Dutch | Verwerken van DSL-invoer is mislukt |
| Portuguese (Brazilian) | Falha ao analisar entrada DSL |
| Russian | Не удалось разобрать ввод DSL |
| Swedish | Misslyckades med att tolka DSL-inmatning |
| Turkish | DSL girişi ayrıştırılamadı |
| Ukrainian | Не вдалося розібрати введення DSL |
| Chinese (Simplified) | 解析DSL输入失败 |
##### `dsl.pattern_empty`
| Locale | Translation |
| ---------------------- | ---------------------------------- |
| German | Muster darf nicht leer sein |
| English | Pattern cannot be empty |
| Spanish | El patrón no puede estar vacío |
| French | Le modèle ne peut pas être vide |
| Italian | Il pattern non può essere vuoto |
| Japanese | パターンを空にすることはできません |
| Korean | 패턴은 비어있을 수 없습니다 |
| Dutch | Patroon kan niet leeg zijn |
| Portuguese (Brazilian) | Padrão não pode estar vazio |
| Russian | Шаблон не может быть пустым |
| Swedish | Mönstret kan inte vara tomt |
| Turkish | Desen boş olamaz |
| Ukrainian | Шаблон не може бути порожнім |
| Chinese (Simplified) | 模式不能为空 |
##### `dsl.unbalanced_parentheses_closing`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------- |
| German | Unausgeglichene Klammern: zu viele schließende Klammern an Position %position% |
| English | Unbalanced parentheses: too many closing parentheses at position %position% |
| Spanish | Paréntesis desequilibrados: demasiados paréntesis de cierre en la posición %position% |
| French | Parenthèses déséquilibrées : trop de parenthèses fermantes à la position %position% |
| Italian | Parentesi non bilanciate: troppe parentesi di chiusura alla posizione %position% |
| Japanese | 括弧の対応が取れていません: 位置%position%に閉じ括弧が多すぎます |
| Korean | 불균형한 괄호: 위치 %position%에 닫는 괄호가 너무 많습니다 |
| Dutch | Ongelijke haakjes: te veel sluithaakjes op positie %position% |
| Portuguese (Brazilian) | Parênteses desequilibrados: muitos parênteses de fechamento na posição %position% |
| Russian | Несбалансированные скобки: слишком много закрывающих скобок в позиции %position% |
| Swedish | Obalanserade parenteser: för många avslutande parenteser vid position %position% |
| Turkish | Dengesiz parantezler: %position% konumunda çok fazla kapanış parantezi |
| Ukrainian | Незбалансовані дужки: забагато закриваючих дужок у позиції %position% |
| Chinese (Simplified) | 括号不匹配:位置%position%有过多的右括号 |
##### `dsl.unbalanced_parentheses_opening`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------- |
| German | Unausgeglichene Klammern: %count% ungeschlossene öffnende %parentheses% |
| English | Unbalanced parentheses: %count% unclosed opening %parentheses% |
| Spanish | Paréntesis desequilibrados: %count% %parentheses% de apertura sin cerrar |
| French | Parenthèses déséquilibrées : %count% %parentheses% ouvrantes non fermées |
| Italian | Parentesi non bilanciate: %count% %parentheses% di apertura non chiuse |
| Japanese | 括弧の対応が取れていません: %count%個の開き%parentheses%が閉じられていません |
| Korean | 불균형한 괄호: %count%개의 열린 %parentheses%가 닫히지 않았습니다 |
| Dutch | Ongelijke haakjes: %count% ongesloten %parentheses% |
| Portuguese (Brazilian) | Parênteses desequilibrados: %count% %parentheses% de abertura não fechados |
| Russian | Несбалансированные скобки: %count% незакрытых открывающих %parentheses% |
| Swedish | Obalanserade parenteser: %count% ostängda öppnande %parentheses% |
| Turkish | Dengesiz parantezler: %count% kapatılmamış açılış %parentheses% |
| Ukrainian | Незбалансовані дужки: %count% незакритих відкриваючих %parentheses% |
| Chinese (Simplified) | 括号不匹配:%count%个未关闭的%parentheses% |
##### `dsl.unrecognized_term`
| Locale | Translation |
| ---------------------- | ------------------------------------ |
| German | Unerkannter DSL-Begriff: %term% |
| English | Unrecognized DSL term: %term% |
| Spanish | Término DSL no reconocido: %term% |
| French | Terme DSL non reconnu : %term% |
| Italian | Termine DSL non riconosciuto: %term% |
| Japanese | 認識されないDSL用語です: %term% |
| Korean | 인식되지 않은 DSL 용어: %term% |
| Dutch | Onbekende DSL-term: %term% |
| Portuguese (Brazilian) | Termo DSL não reconhecido: %term% |
| Russian | Нераспознанный термин DSL: %term% |
| Swedish | Okänd DSL-term: %term% |
| Turkish | Tanınmayan DSL terimi: %term% |
| Ukrainian | Нерозпізнаний термін DSL: %term% |
| Chinese (Simplified) | 无法识别的DSL术语:%term% |
##### `validation.batch_check_empty`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------- |
| German | Batch-Check-Anfrage darf nicht leer sein |
| English | Batch check request cannot be empty |
| Spanish | La solicitud de verificación por lotes no puede estar vacía |
| French | La requête de vérification par lot ne peut pas être vide |
| Italian | La richiesta di controllo batch non può essere vuota |
| Japanese | バッチチェックリクエストを空にすることはできません |
| Korean | 배치 확인 요청은 비어있을 수 없습니다 |
| Dutch | Batchcontrole verzoek kan niet leeg zijn |
| Portuguese (Brazilian) | Requisição de verificação em lote não pode estar vazia |
| Russian | Запрос пакетной проверки не может быть пустым |
| Swedish | Batch-kontrollförfrågan kan inte vara tom |
| Turkish | Toplu kontrol isteği boş olamaz |
| Ukrainian | Запит пакетної перевірки не може бути порожнім |
| Chinese (Simplified) | 批量检查请求不能为空 |
##### `validation.invalid_correlation_id`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ |
| German | Korrelations-ID '%correlationId%' ist ungültig. Muss dem Muster entsprechen: %pattern% |
| English | Correlation ID "%correlationId%" is invalid. Must match pattern: %pattern% |
| Spanish | ID de correlación "%correlationId%" es inválido. Debe coincidir con el patrón: %pattern% |
| French | L''ID de corrélation "%correlationId%" est invalide. Doit correspondre au modèle : %pattern% |
| Italian | L''ID di correlazione "%correlationId%" non è valido. Deve corrispondere al pattern: %pattern% |
| Japanese | 相関ID「%correlationId%」は無効です。パターンと一致する必要があります: %pattern% |
| Korean | 상관관계 ID "%correlationId%"가 잘못되었습니다. 패턴과 일치해야 합니다: %pattern% |
| Dutch | Correlatie-ID "%correlationId%" is ongeldig. Moet overeenkomen met patroon: %pattern% |
| Portuguese (Brazilian) | ID de correlação "%correlationId%" é inválido. Deve corresponder ao padrão: %pattern% |
| Russian | ID корреляции "%correlationId%" недопустим. Должен соответствовать шаблону: %pattern% |
| Swedish | Korrelations-ID "%correlationId%" är ogiltigt. Måste matcha mönster: %pattern% |
| Turkish | Korelasyon ID "%correlationId%" geçersiz. Desene uymalı: %pattern% |
| Ukrainian | ID кореляції "%correlationId%" недійсний. Має відповідати шаблону: %pattern% |
| Chinese (Simplified) | 关联ID"%correlationId%"无效。必须匹配模式:%pattern% |
##### `auth.jwt.invalid_audience`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------------- |
| German | JWT-Token-Zielgruppe stimmt nicht mit erwarteter Zielgruppe überein |
| English | JWT token audience does not match expected audience |
| Spanish | La audiencia del token JWT no coincide con la audiencia esperada |
| French | L'audience du jeton JWT ne correspond pas à l'audience attendue |
| Italian | L''audience del token JWT non corrisponde all''audience atteso |
| Japanese | JWTトークンの対象者が期待される対象者と一致しません |
| Korean | JWT 토큰 대상이 예상 대상과 일치하지 않습니다 |
| Dutch | JWT-token doelgroep komt niet overeen met verwachte doelgroep |
| Portuguese (Brazilian) | Audiência do token JWT não corresponde à audiência esperada |
| Russian | Аудитория JWT токена не соответствует ожидаемой аудитории |
| Swedish | JWT-tokens målgrupp matchar inte förväntad målgrupp |
| Turkish | JWT token hedef kitlesi beklenen hedef kitle ile eşleşmiyor |
| Ukrainian | Аудиторія JWT токена не відповідає очікуваній аудиторії |
| Chinese (Simplified) | JWT令牌受众与期望受众不匹配 |
##### `auth.jwt.invalid_format`
| Locale | Translation |
| ---------------------- | ------------------------------ |
| German | Ungültiges JWT-Token-Format |
| English | Invalid JWT token format |
| Spanish | Formato de token JWT inválido |
| French | Format de jeton JWT invalide |
| Italian | Formato token JWT non valido |
| Japanese | 無効なJWTトークン形式です |
| Korean | 잘못된 JWT 토큰 형식 |
| Dutch | Ongeldig JWT-tokenformaat |
| Portuguese (Brazilian) | Formato de token JWT inválido |
| Russian | Недопустимый формат JWT токена |
| Swedish | Ogiltigt JWT-tokenformat |
| Turkish | Geçersiz JWT token formatı |
| Ukrainian | Недійсний формат JWT токена |
| Chinese (Simplified) | 无效的JWT令牌格式 |
##### `auth.jwt.invalid_header`
| Locale | Translation |
| ---------------------- | -------------------------- |
| German | Ungültiger JWT-Header |
| English | Invalid JWT header |
| Spanish | Encabezado JWT inválido |
| French | En-tête JWT invalide |
| Italian | Header JWT non valido |
| Japanese | 無効なJWTヘッダーです |
| Korean | 잘못된 JWT 헤더 |
| Dutch | Ongeldige JWT-header |
| Portuguese (Brazilian) | Cabeçalho JWT inválido |
| Russian | Недопустимый заголовок JWT |
| Swedish | Ogiltig JWT-header |
| Turkish | Geçersiz JWT başlığı |
| Ukrainian | Недійсний заголовок JWT |
| Chinese (Simplified) | 无效的JWT标头 |
##### `auth.jwt.invalid_issuer`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------ |
| German | JWT-Token-Aussteller stimmt nicht mit erwartetem Aussteller überein |
| English | JWT token issuer does not match expected issuer |
| Spanish | El emisor del token JWT no coincide con el emisor esperado |
| French | L'émetteur du jeton JWT ne correspond pas à l'émetteur attendu |
| Italian | L''emittente del token JWT non corrisponde all''emittente atteso |
| Japanese | JWTトークンの発行者が期待される発行者と一致しません |
| Korean | JWT 토큰 발급자가 예상 발급자와 일치하지 않습니다 |
| Dutch | JWT-token uitgever komt niet overeen met verwachte uitgever |
| Portuguese (Brazilian) | Emissor do token JWT não corresponde ao emissor esperado |
| Russian | Издатель JWT токена не соответствует ожидаемому издателю |
| Swedish | JWT-tokens utgivare matchar inte förväntad utgivare |
| Turkish | JWT token veren beklenen veren ile eşleşmiyor |
| Ukrainian | Видавець JWT токена не відповідає очікуваному видавцю |
| Chinese (Simplified) | JWT令牌颁发者与期望颁发者不匹配 |
##### `auth.jwt.invalid_payload`
| Locale | Translation |
| ---------------------- | ---------------------------------- |
| German | Ungültige JWT-Nutzlast |
| English | Invalid JWT payload |
| Spanish | Carga útil JWT inválida |
| French | Charge utile JWT invalide |
| Italian | Payload JWT non valido |
| Japanese | 無効なJWTペイロードです |
| Korean | 잘못된 JWT 페이로드 |
| Dutch | Ongeldige JWT-payload |
| Portuguese (Brazilian) | Payload JWT inválido |
| Russian | Недопустимая полезная нагрузка JWT |
| Swedish | Ogiltig JWT-payload |
| Turkish | Geçersiz JWT yükü |
| Ukrainian | Недійсне корисне навантаження JWT |
| Chinese (Simplified) | 无效的JWT有效负载 |
##### `auth.jwt.missing_required_claims`
| Locale | Translation |
| ---------------------- | ---------------------------------------- |
| German | Erforderliche JWT-Claims fehlen |
| English | Missing required JWT claims |
| Spanish | Faltan claims requeridos en el JWT |
| French | Revendications JWT requises manquantes |
| Italian | Claims JWT obbligatori mancanti |
| Japanese | 必要なJWTクレームがありません |
| Korean | 필수 JWT 클레임이 누락되었습니다 |
| Dutch | Ontbrekende vereiste JWT-claims |
| Portuguese (Brazilian) | Claims JWT obrigatórios faltando |
| Russian | Отсутствуют обязательные утверждения JWT |
| Swedish | Saknade obligatoriska JWT-anspråk |
| Turkish | Gerekli JWT talepleri eksik |
| Ukrainian | Відсутні обов'язкові твердження JWT |
| Chinese (Simplified) | 缺少必需的JWT声明 |
##### `auth.jwt.token_expired`
| Locale | Translation |
| ---------------------- | --------------------------------- |
| German | JWT-Token ist abgelaufen |
| English | JWT token has expired |
| Spanish | El token JWT ha expirado |
| French | Le jeton JWT a expiré |
| Italian | Il token JWT è scaduto |
| Japanese | JWTトークンの有効期限が切れました |
| Korean | JWT 토큰이 만료되었습니다 |
| Dutch | JWT-token is verlopen |
| Portuguese (Brazilian) | Token JWT expirou |
| Russian | JWT токен истек |
| Swedish | JWT-token har gått ut |
| Turkish | JWT token süresi doldu |
| Ukrainian | JWT токен закінчився |
| Chinese (Simplified) | JWT令牌已过期 |
##### `auth.jwt.token_not_yet_valid`
| Locale | Translation |
| ---------------------- | ----------------------------------------- |
| German | JWT-Token ist noch nicht gültig |
| English | JWT token is not yet valid |
| Spanish | El token JWT aún no es válido |
| French | Le jeton JWT n'est pas encore valide |
| Italian | Il token JWT non è ancora valido |
| Japanese | JWTトークンはまだ有効ではありません |
| Korean | JWT 토큰이 아직 유효하지 않습니다 |
| Dutch | JWT-token is nog niet geldig |
| Portuguese (Brazilian) | Token JWT ainda não é válido |
| Russian | JWT токен еще не действителен |
| Swedish | JWT-token är inte giltigt ännu |
| Turkish | JWT token henüz geçerli değil |
| Ukrainian | JWT токен ще не дійсний |
| Chinese (Simplified) | JWT令牌尚未生效 |
##### `model.duplicate_type`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------- |
| German | Doppelte Typdefinition gefunden: %type% |
| English | Duplicate type definition found: %type% |
| Spanish | Se encontró una definición de tipo duplicada: %type% |
| French | Définition de type dupliquée trouvée : %type% |
| Italian | Definizione di tipo duplicata trovata: %type% |
| Japanese | 重複するタイプ定義が見つかりました: %type% |
| Korean | 중복된 타입 정의를 발견했습니다: %type% |
| Dutch | Dubbele typedefinitie gevonden: %type% |
| Portuguese (Brazilian) | Definição de tipo duplicada encontrada: %type% |
| Russian | Найдено дублирующееся определение типа: %type% |
| Swedish | Dubblerad typdefinition hittades: %type% |
| Turkish | Yinelenen tür tanımı bulundu: %type% |
| Ukrainian | Знайдено дублікат визначення типу: %type% |
| Chinese (Simplified) | 发现重复的类型定义:%type% |
##### `model.invalid_identifier_format`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| German | Ungültiges Bezeichnerformat: Bezeichner dürfen keine Leerzeichen enthalten. Gefunden in %identifier% |
| English | Invalid identifier format: identifiers cannot contain whitespace. Found in %identifier% |
| Spanish | Formato de identificador inválido: los identificadores no pueden contener espacios en blanco. Encontrado en %identifier% |
| French | Format d'identifiant invalide : les identifiants ne peuvent pas contenir d'espaces. Trouvé dans %identifier% |
| Italian | Formato identificatore non valido: gli identificatori non possono contenere spazi. Trovato in %identifier% |
| Japanese | 無効な識別子形式です: 識別子に空白文字を含めることはできません。%identifier%で見つかりました |
| Korean | 잘못된 식별자 형식: 식별자에는 공백이 포함될 수 없습니다. %identifier%에서 발견되었습니다 |
| Dutch | Ongeldig identificatieformaat: identificaties kunnen geen witruimte bevatten. Gevonden in %identifier% |
| Portuguese (Brazilian) | Formato de identificador inválido: identificadores não podem conter espaços em branco. Encontrado em %identifier% |
| Russian | Недопустимый формат идентификатора: идентификаторы не могут содержать пробелы. Найдено в %identifier% |
| Swedish | Ogiltigt identifierarformat: identifierare kan inte innehålla mellanslag. Hittades i %identifier% |
| Turkish | Geçersiz tanımlayıcı formatı: tanımlayıcılar boşluk içeremez. %identifier% içinde bulundu |
| Ukrainian | Недійсний формат ідентифікатора: ідентифікатори не можуть містити пробіли. Знайдено в %identifier% |
| Chinese (Simplified) | 无效的标识符格式:标识符不能包含空白字符。在%identifier%中发现 |
##### `model.invalid_tuple_key`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------ |
| German | Ungültiger tuple_key für Assertion::fromArray bereitgestellt |
| English | Invalid tuple_key provided to Assertion::fromArray |
| Spanish | tuple_key inválido proporcionado a Assertion::fromArray |
| French | tuple_key invalide fourni à Assertion::fromArray |
| Italian | tuple_key non valido fornito ad Assertion::fromArray |
| Japanese | Assertion::fromArrayに無効なtuple_keyが提供されました |
| Korean | Assertion::fromArray에 잘못된 tuple_key가 제공되었습니다 |
| Dutch | Ongeldige tuple_key verstrekt aan Assertion::fromArray |
| Portuguese (Brazilian) | tuple_key inválido fornecido para Assertion::fromArray |
| Russian | Недопустимый tuple_key предоставлен для Assertion::fromArray |
| Swedish | Ogiltig tuple_key tillhandahållen till Assertion::fromArray |
| Turkish | Assertion::fromArray için geçersiz tuple_key sağlandı |
| Ukrainian | Недійсний tuple_key надано для Assertion::fromArray |
| Chinese (Simplified) | 提供给Assertion::fromArray的tuple_key无效 |
##### `model.leaf_missing_content`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------------------------- |
| German | Blatt muss mindestens eines von users, computed oder tupleToUserset enthalten |
| English | Leaf must contain at least one of users, computed or tupleToUserset |
| Spanish | Leaf debe contener al menos uno de: users, computed o tupleToUserset |
| French | Leaf doit contenir au moins un des éléments suivants : users, computed ou tupleToUserset |
| Italian | Leaf deve contenere almeno uno tra users, computed o tupleToUserset |
| Japanese | LeafにはusersまたはcomputedまたはtupleToUsersetのうち少なくとも1つが含まれている必要があります |
| Korean | Leaf는 users, computed 또는 tupleToUserset 중 적어도 하나를 포함해야 합니다 |
| Dutch | Leaf moet ten minste één van users, computed of tupleToUserset bevatten |
| Portuguese (Brazilian) | Leaf deve conter pelo menos um de users, computed ou tupleToUserset |
| Russian | Leaf должен содержать хотя бы одно из users, computed или tupleToUserset |
| Swedish | Leaf måste innehålla minst en av users, computed eller tupleToUserset |
| Turkish | Leaf en az bir users, computed veya tupleToUserset içermelidir |
| Ukrainian | Leaf має містити принаймні одне з users, computed або tupleToUserset |
| Chinese (Simplified) | Leaf必须包含users、computed或tupleToUserset中的至少一个 |
##### `model.no_models_in_store`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------ |
| German | Keine Autorisierungsmodelle in Store %store_id% gefunden |
| English | No authorization models found in store %store_id% |
| Spanish | No se encontraron modelos de autorización en el almacén %store_id% |
| French | Aucun modèle d'autorisation trouvé dans le magasin %store_id% |
| Italian | Nessun modello di autorizzazione trovato nello store %store_id% |
| Japanese | ストア%store_id%に認可モデルが見つかりません |
| Korean | 스토어 %store_id%에서 인증 모델을 찾을 수 없습니다 |
| Dutch | Geen autorisatiemodellen gevonden in store %store_id% |
| Portuguese (Brazilian) | Nenhum modelo de autorização encontrado no store %store_id% |
| Russian | Модели авторизации не найдены в хранилище %store_id% |
| Swedish | Inga auktorisationsmodeller hittades i butik %store_id% |
| Turkish | %store_id% mağazasında yetkilendirme modeli bulunamadı |
| Ukrainian | Моделі авторизації не знайдені у сховищі %store_id% |
| Chinese (Simplified) | 在存储%store_id%中未找到授权模型 |
##### `model.source_info_file_empty`
| Locale | Translation |
| ---------------------- | --------------------------------------------- |
| German | SourceInfo::$file darf nicht leer sein. |
| English | SourceInfo::$file cannot be empty. |
| Spanish | SourceInfo::$file no puede estar vacío. |
| French | SourceInfo::$file ne peut pas être vide. |
| Italian | SourceInfo::$file non può essere vuoto. |
| Japanese | SourceInfo::$fileを空にすることはできません。 |
| Korean | SourceInfo::$file은 비어있을 수 없습니다. |
| Dutch | SourceInfo::$file kan niet leeg zijn. |
| Portuguese (Brazilian) | SourceInfo::$file não pode estar vazio. |
| Russian | SourceInfo::$file не может быть пустым. |
| Swedish | SourceInfo::$file kan inte vara tom. |
| Turkish | SourceInfo::$file boş olamaz. |
| Ukrainian | SourceInfo::$file не може бути порожнім. |
| Chinese (Simplified) | SourceInfo::$file不能为空。 |
##### `model.type_definitions_empty`
| Locale | Translation |
| ---------------------- | ------------------------------------------------- |
| German | Typdefinitionen dürfen nicht leer sein |
| English | Type definitions cannot be empty |
| Spanish | Las definiciones de tipo no pueden estar vacías |
| French | Les définitions de type ne peuvent pas être vides |
| Italian | Le definizioni di tipo non possono essere vuote |
| Japanese | タイプ定義を空にすることはできません |
| Korean | 타입 정의는 비어있을 수 없습니다 |
| Dutch | Typedefinities kunnen niet leeg zijn |
| Portuguese (Brazilian) | Definições de tipo não podem estar vazias |
| Russian | Определения типов не могут быть пустыми |
| Swedish | Typdefinitioner kan inte vara tomma |
| Turkish | Tür tanımları boş olamaz |
| Ukrainian | Визначення типів не можуть бути порожніми |
| Chinese (Simplified) | 类型定义不能为空 |
##### `model.typed_wildcard_type_empty`
| Locale | Translation |
| ---------------------- | ------------------------------------------------ |
| German | TypedWildcard::$type darf nicht leer sein. |
| English | TypedWildcard::$type cannot be empty. |
| Spanish | TypedWildcard::$type no puede estar vacío. |
| French | TypedWildcard::$type ne peut pas être vide. |
| Italian | TypedWildcard::$type non può essere vuoto. |
| Japanese | TypedWildcard::$typeを空にすることはできません。 |
| Korean | TypedWildcard::$type은 비어있을 수 없습니다. |
| Dutch | TypedWildcard::$type kan niet leeg zijn. |
| Portuguese (Brazilian) | TypedWildcard::$type não pode estar vazio. |
| Russian | TypedWildcard::$type не может быть пустым. |
| Swedish | TypedWildcard::$type kan inte vara tom. |
| Turkish | TypedWildcard::$type boş olamaz. |
| Ukrainian | TypedWildcard::$type не може бути порожнім. |
| Chinese (Simplified) | TypedWildcard::$type不能为空。 |
##### `network.error`
| Locale | Translation |
| ---------------------- | ----------------------------- |
| German | Netzwerkfehler: %message% |
| English | Network error: %message% |
| Spanish | Error de red: %message% |
| French | Erreur réseau : %message% |
| Italian | Errore di rete: %message% |
| Japanese | ネットワークエラー: %message% |
| Korean | 네트워크 오류: %message% |
| Dutch | Netwerkfout: %message% |
| Portuguese (Brazilian) | Erro de rede: %message% |
| Russian | Сетевая ошибка: %message% |
| Swedish | Nätverksfel: %message% |
| Turkish | Ağ hatası: %message% |
| Ukrainian | Мережева помилка: %message% |
| Chinese (Simplified) | 网络错误:%message% |
##### `exception.network.conflict`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------------- |
| German | Konflikt (409): Die Anfrage steht im Konflikt mit dem aktuellen Zustand |
| English | Conflict (409): The request conflicts with the current state |
| Spanish | Conflicto (409): La solicitud entra en conflicto con el estado actual |
| French | Conflit (409) : La requête entre en conflit avec l'état actuel |
| Italian | Conflitto (409): La richiesta è in conflitto con lo stato attuale |
| Japanese | 競合 (409): リクエストが現在の状態と競合しています |
| Korean | 충돌 (409): 요청이 현재 상태와 충돌합니다 |
| Dutch | Conflict (409): Het verzoek conflicteert met de huidige staat |
| Portuguese (Brazilian) | Conflito (409): A requisição conflita com o estado atual |
| Russian | Конфликт (409): Запрос конфликтует с текущим состоянием |
| Swedish | Konflikt (409): Begäran står i konflikt med nuvarande tillstånd |
| Turkish | Çakışma (409): İstek mevcut durumla çakışıyor |
| Ukrainian | Конфлікт (409): Запит конфліктує з поточним станом |
| Chinese (Simplified) | 冲突(409):请求与当前状态冲突 |
##### `exception.network.forbidden`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------- |
| German | Verboten (403): Zugriff auf die angeforderte Ressource verweigert |
| English | Forbidden (403): Access denied to the requested resource |
| Spanish | Prohibido (403): Acceso denegado al recurso solicitado |
| French | Interdit (403) : Accès refusé à la ressource demandée |
| Italian | Vietato (403): Accesso negato alla risorsa richiesta |
| Japanese | 禁止 (403): 要求されたリソースへのアクセスが拒否されました |
| Korean | 금지됨 (403): 요청된 리소스에 대한 액세스가 거부되었습니다 |
| Dutch | Verboden (403): Toegang geweigerd tot de gevraagde bron |
| Portuguese (Brazilian) | Proibido (403): Acesso negado ao recurso solicitado |
| Russian | Запрещено (403): Доступ к запрашиваемому ресурсу запрещен |
| Swedish | Förbjuden (403): Åtkomst nekad till begärd resurs |
| Turkish | Yasak (403): İstenen kaynağa erişim reddedildi |
| Ukrainian | Заборонено (403): Доступ до запитуваного ресурсу заборонений |
| Chinese (Simplified) | 禁止(403):拒绝访问请求的资源 |
##### `exception.network.invalid`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------- |
| German | Ungültige Anfrage (400): Die Anfrage ist ungültig |
| English | Bad Request (400): The request is invalid |
| Spanish | Solicitud incorrecta (400): La solicitud no es válida |
| French | Requête incorrecte (400) : La requête est invalide |
| Italian | Richiesta non valida (400): La richiesta non è valida |
| Japanese | 無効なリクエスト (400): リクエストが無効です |
| Korean | 잘못된 요청 (400): 요청이 잘못되었습니다 |
| Dutch | Slecht Verzoek (400): Het verzoek is ongeldig |
| Portuguese (Brazilian) | Requisição Inválida (400): A requisição é inválida |
| Russian | Неверный запрос (400): Запрос недействителен |
| Swedish | Dålig begäran (400): Begäran är ogiltig |
| Turkish | Hatalı İstek (400): İstek geçersiz |
| Ukrainian | Невірний запит (400): Запит недійсний |
| Chinese (Simplified) | 错误请求(400):请求无效 |
##### `exception.network.request`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------- |
| German | Anfrage fehlgeschlagen: HTTP-Anfrage konnte nicht abgeschlossen werden |
| English | Request failed: Unable to complete the HTTP request |
| Spanish | Solicitud fallida: No se pudo completar la solicitud HTTP |
| French | Échec de la requête : Impossible de terminer la requête HTTP |
| Italian | Richiesta fallita: Impossibile completare la richiesta HTTP |
| Japanese | リクエスト失敗: HTTPリクエストを完了できませんでした |
| Korean | 요청 실패: HTTP 요청을 완료할 수 없습니다 |
| Dutch | Verzoek mislukt: Kan het HTTP-verzoek niet voltooien |
| Portuguese (Brazilian) | Requisição falhou: Não foi possível completar a requisição HTTP |
| Russian | Запрос не удался: Невозможно выполнить HTTP запрос |
| Swedish | Begäran misslyckades: Kunde inte slutföra HTTP-begäran |
| Turkish | İstek başarısız: HTTP isteği tamamlanamadı |
| Ukrainian | Запит не вдався: Неможливо завершити HTTP запит |
| Chinese (Simplified) | 请求失败:无法完成HTTP请求 |
##### `exception.network.server`
| Locale | Translation |
| ---------------------- | --------------------------------------------------------------------- |
| German | Interner Serverfehler (500): Der Server ist auf einen Fehler gestoßen |
| English | Internal Server Error (500): The server encountered an error |
| Spanish | Error interno del servidor (500): El servidor encontró un error |
| French | Erreur interne du serveur (500) : Le serveur a rencontré une erreur |
| Italian | Errore interno del server (500): Il server ha incontrato un errore |
| Japanese | 内部サーバーエラー (500): サーバーでエラーが発生しました |
| Korean | 내부 서버 오류 (500): 서버에서 오류가 발생했습니다 |
| Dutch | Interne Serverfout (500): De server ondervond een fout |
| Portuguese (Brazilian) | Erro Interno do Servidor (500): O servidor encontrou um erro |
| Russian | Внутренняя ошибка сервера (500): На сервере произошла ошибка |
| Swedish | Internt serverfel (500): Servern stötte på ett fel |
| Turkish | İç Sunucu Hatası (500): Sunucuda hata oluştu |
| Ukrainian | Внутрішня помилка сервера (500): На сервері сталася помилка |
| Chinese (Simplified) | 内部服务器错误(500):服务器遇到错误 |
##### `exception.network.timeout`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------ |
| German | Nicht verarbeitbare Entität (422): Die Anfrage konnte nicht verarbeitet werden |
| English | Unprocessable Entity (422): The request could not be processed |
| Spanish | Entidad no procesable (422): No se pudo procesar la solicitud |
| French | Entité non traitable (422) : La requête n'a pas pu être traitée |
| Italian | Entità non processabile (422): La richiesta non può essere processata |
| Japanese | 処理不可能エンティティ (422): リクエストを処理できませんでした |
| Korean | 처리할 수 없는 엔티티 (422): 요청을 처리할 수 없습니다 |
| Dutch | Onverwerkbare Entiteit (422): Het verzoek kon niet verwerkt worden |
| Portuguese (Brazilian) | Entidade Não Processável (422): A requisição não pôde ser processada |
| Russian | Необработанная сущность (422): Запрос не может быть обработан |
| Swedish | Obearbetbar entitet (422): Begäran kunde inte bearbetas |
| Turkish | İşlenemeyen Varlık (422): İstek işlenemedi |
| Ukrainian | Необроблювана сутність (422): Запит не може бути оброблений |
| Chinese (Simplified) | 无法处理的实体(422):无法处理请求 |
##### `exception.network.unauthenticated`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------- |
| German | Nicht autorisiert (401): Authentifizierung erforderlich |
| English | Unauthorized (401): Authentication required |
| Spanish | No autorizado (401): Se requiere autenticación |
| French | Non autorisé (401) : Authentification requise |
| Italian | Non autorizzato (401): Autenticazione richiesta |
| Japanese | 未認証 (401): 認証が必要です |
| Korean | 인증되지 않음 (401): 인증이 필요합니다 |
| Dutch | Ongeautoriseerd (401): Authenticatie vereist |
| Portuguese (Brazilian) | Não Autorizado (401): Autenticação necessária |
| Russian | Неавторизован (401): Требуется аутентификация |
| Swedish | Obehörig (401): Autentisering krävs |
| Turkish | Yetkisiz (401): Kimlik doğrulama gerekli |
| Ukrainian | Неавторизований (401): Потрібна автентифікація |
| Chinese (Simplified) | 未授权(401):需要身份验证 |
##### `exception.network.undefined_endpoint`
| Locale | Translation |
| ---------------------- | -------------------------------------------------------------------- |
| German | Nicht gefunden (404): Der angeforderte Endpunkt existiert nicht |
| English | Not Found (404): The requested endpoint does not exist |
| Spanish | No encontrado (404): El endpoint solicitado no existe |
| French | Non trouvé (404) : Le point de terminaison demandé n'existe pas |
| Italian | Non trovato (404): L''endpoint richiesto non esiste |
| Japanese | 見つかりません (404): 要求されたエンドポイントは存在しません |
| Korean | 찾을 수 없음 (404): 요청된 엔드포인트가 존재하지 않습니다 |
| Dutch | Niet Gevonden (404): Het gevraagde eindpunt bestaat niet |
| Portuguese (Brazilian) | Não Encontrado (404): O endpoint solicitado não existe |
| Russian | Не найдено (404): Запрашиваемая конечная точка не существует |
| Swedish | Inte hittad (404): Den begärda slutpunkten existerar inte |
| Turkish | Bulunamadı (404): İstenen uç nokta mevcut değil |
| Ukrainian | Не знайдено (404): Запитувана кінцева точка не існує |
| Chinese (Simplified) | 未找到(404):请求的端点不存在 |
##### `exception.network.unexpected`
| Locale | Translation |
| ---------------------- | ----------------------------------- |
| German | Unerwartete Antwort vom Server |
| English | Unexpected response from the server |
| Spanish | Respuesta inesperada del servidor |
| French | Réponse inattendue du serveur |
| Italian | Risposta inaspettata dal server |
| Japanese | サーバーからの予期しないレスポンス |
| Korean | 서버로부터 예상치 못한 응답 |
| Dutch | Onverwachte respons van de server |
| Portuguese (Brazilian) | Resposta inesperada do servidor |
| Russian | Неожиданный ответ от сервера |
| Swedish | Oväntat svar från servern |
| Turkish | Sunucudan beklenmeyen yanıt |
| Ukrainian | Неочікувана відповідь від сервера |
| Chinese (Simplified) | 来自服务器的意外响应 |
##### `network.unexpected_status`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------ |
| German | API antwortete mit einem unerwarteten Statuscode: %status_code% |
| English | API responded with an unexpected status code: %status_code% |
| Spanish | La API respondió con un código de estado inesperado: %status_code% |
| French | L'API a répondu avec un code de statut inattendu : %status_code% |
| Italian | L''API ha risposto con un codice di stato inaspettato: %status_code% |
| Japanese | APIが予期しないステータスコードで応答しました: %status_code% |
| Korean | API가 예상치 못한 상태 코드로 응답했습니다: %status_code% |
| Dutch | API reageerde met een onverwachte statuscode: %status_code% |
| Portuguese (Brazilian) | API respondeu com código de status inesperado: %status_code% |
| Russian | API ответил неожиданным кодом состояния: %status_code% |
| Swedish | API svarade med en oväntad statuskod: %status_code% |
| Turkish | API beklenmeyen durum koduyla yanıt verdi: %status_code% |
| Ukrainian | API відповів неочікуваним кодом стану: %status_code% |
| Chinese (Simplified) | API返回了意外的状态代码:%status_code% |
##### `client.no_last_request_found`
| Locale | Translation |
| ---------------------- | ------------------------------------ |
| German | Keine letzte Anfrage gefunden |
| English | No last request found |
| Spanish | No se encontró la última solicitud |
| French | Aucune dernière requête trouvée |
| Italian | Nessuna ultima richiesta trovata |
| Japanese | 最後のリクエストが見つかりません |
| Korean | 마지막 요청을 찾을 수 없습니다 |
| Dutch | Geen laatste verzoek gevonden |
| Portuguese (Brazilian) | Nenhuma última requisição encontrada |
| Russian | Последний запрос не найден |
| Swedish | Ingen senaste förfrågan hittades |
| Turkish | Son istek bulunamadı |
| Ukrainian | Останній запит не знайдено |
| Chinese (Simplified) | 未找到最后的请求 |
##### `request.continuation_token_empty`
| Locale | Translation |
| ---------------------- | ---------------------------------------------- |
| German | Fortsetzungstoken darf nicht leer sein |
| English | Continuation token cannot be empty |
| Spanish | El token de continuación no puede estar vacío |
| French | Le jeton de continuation ne peut pas être vide |
| Italian | Il token di continuazione non può essere vuoto |
| Japanese | 継続トークンを空にすることはできません |
| Korean | 연속 토큰은 비어있을 수 없습니다 |
| Dutch | Vervolgtoken kan niet leeg zijn |
| Portuguese (Brazilian) | Token de continuação não pode estar vazio |
| Russian | Токен продолжения не может быть пустым |
| Swedish | Fortsättningstoken kan inte vara tomt |
| Turkish | Devam tokeni boş olamaz |
| Ukrainian | Токен продовження не може бути порожнім |
| Chinese (Simplified) | 继续令牌不能为空 |
##### `request.model_id_empty`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------ |
| German | Autorisierungsmodell-ID darf nicht leer sein |
| English | Authorization Model ID cannot be empty |
| Spanish | El ID del modelo de autorización no puede estar vacío |
| French | L'ID du modèle d'autorisation ne peut pas être vide |
| Italian | L''ID del modello di autorizzazione non può essere vuoto |
| Japanese | 認可モデルIDを空にすることはできません |
| Korean | 인증 모델 ID는 비어있을 수 없습니다 |
| Dutch | Autorisatiemodel-ID kan niet leeg zijn |
| Portuguese (Brazilian) | ID do modelo de autorização não pode estar vazio |
| Russian | ID модели авторизации не может быть пустым |
| Swedish | Auktorisationsmodell-ID kan inte vara tomt |
| Turkish | Yetkilendirme Modeli ID boş olamaz |
| Ukrainian | ID моделі авторизації не може бути порожнім |
| Chinese (Simplified) | 授权模型ID不能为空 |
##### `request.object_empty`
| Locale | Translation |
| ---------------------- | ----------------------------------------- |
| German | Objekt darf nicht leer sein |
| English | Object cannot be empty |
| Spanish | El objeto no puede estar vacío |
| French | L'objet ne peut pas être vide |
| Italian | L''oggetto non può essere vuoto |
| Japanese | オブジェクトを空にすることはできません |
| Korean | 객체는 비어있을 수 없습니다 |
| Dutch | Object kan niet leeg zijn |
| Portuguese (Brazilian) | Objeto não pode estar vazio |
| Russian | Объект не может быть пустым |
| Swedish | Objekt kan inte vara tomt |
| Turkish | Nesne boş olamaz |
| Ukrainian | Об'єкт не може бути порожнім |
| Chinese (Simplified) | 对象不能为空 |
##### `request.object_type_empty`
| Locale | Translation |
| ---------------------- | -------------------------------------------- |
| German | Objekttyp darf nicht leer sein |
| English | Object type cannot be empty |
| Spanish | El tipo de objeto no puede estar vacío |
| French | Le type d'objet ne peut pas être vide |
| Italian | Il tipo di oggetto non può essere vuoto |
| Japanese | オブジェクトタイプを空にすることはできません |
| Korean | 객체 타입은 비어있을 수 없습니다 |
| Dutch | Objecttype kan niet leeg zijn |
| Portuguese (Brazilian) | Tipo de objeto não pode estar vazio |
| Russian | Тип объекта не может быть пустым |
| Swedish | Objekttyp kan inte vara tom |
| Turkish | Nesne türü boş olamaz |
| Ukrainian | Тип об'єкта не може бути порожнім |
| Chinese (Simplified) | 对象类型不能为空 |
##### `request.page_size_invalid`
| Locale | Translation |
| ---------------------- | -------------------------------------------------- |
| German | Ungültige pageSize für %className% bereitgestellt |
| English | Invalid pageSize provided to %className% |
| Spanish | pageSize inválido proporcionado a %className% |
| French | pageSize invalide fourni à %className% |
| Italian | pageSize non valido fornito a %className% |
| Japanese | %className%に無効なpageSizeが提供されました |
| Korean | %className%에 잘못된 pageSize가 제공되었습니다 |
| Dutch | Ongeldige pageSize verstrekt aan %className% |
| Portuguese (Brazilian) | pageSize inválido fornecido para %className% |
| Russian | Недопустимый pageSize предоставлен для %className% |
| Swedish | Ogiltig pageSize tillhandahållen till %className% |
| Turkish | %className% için geçersiz pageSize sağlandı |
| Ukrainian | Недійсний pageSize надано для %className% |
| Chinese (Simplified) | 提供给%className%的pageSize无效 |
##### `request.relation_empty`
| Locale | Translation |
| ---------------------- | --------------------------------- |
| German | Relation darf nicht leer sein |
| English | Relation cannot be empty |
| Spanish | La relación no puede estar vacía |
| French | La relation ne peut pas être vide |
| Italian | La relazione non può essere vuota |
| Japanese | 関係を空にすることはできません |
| Korean | 관계는 비어있을 수 없습니다 |
| Dutch | Relatie kan niet leeg zijn |
| Portuguese (Brazilian) | Relação não pode estar vazia |
| Russian | Отношение не может быть пустым |
| Swedish | Relation kan inte vara tom |
| Turkish | İlişki boş olamaz |
| Ukrainian | Відношення не може бути порожнім |
| Chinese (Simplified) | 关系不能为空 |
##### `request.store_id_empty`
| Locale | Translation |
| ---------------------- | ------------------------------------------------ |
| German | Store-ID darf nicht leer sein |
| English | Store ID cannot be empty |
| Spanish | El ID del almacén no puede estar vacío |
| French | L'ID du magasin ne peut pas être vide |
| Italian | L''ID dello store non può essere vuoto |
| Japanese | ストアIDを空にすることはできません |
| Korean | 스토어 ID는 비어있을 수 없습니다 |
| Dutch | Store-ID kan niet leeg zijn |
| Portuguese (Brazilian) | ID do store não pode estar vazio |
| Russian | ID хранилища не может быть пустым |
| Swedish | Butiks-ID kan inte vara tomt |
| Turkish | Mağaza ID boş olamaz |
| Ukrainian | ID сховища не може бути порожнім |
| Chinese (Simplified) | 存储ID不能为空 |
##### `request.store_name_empty`
| Locale | Translation |
| ---------------------- | ------------------------------------------ |
| German | Store-Name darf nicht leer sein |
| English | Store name cannot be empty |
| Spanish | El nombre del almacén no puede estar vacío |
| French | Le nom du magasin ne peut pas être vide |
| Italian | Il nome dello store non può essere vuoto |
| Japanese | ストア名を空にすることはできません |
| Korean | 스토어 이름은 비어있을 수 없습니다 |
| Dutch | Storenaam kan niet leeg zijn |
| Portuguese (Brazilian) | Nome do store não pode estar vazio |
| Russian | Имя хранилища не может быть пустым |
| Swedish | Butiksnamn kan inte vara tomt |
| Turkish | Mağaza adı boş olamaz |
| Ukrainian | Ім'я сховища не може бути порожнім |
| Chinese (Simplified) | 存储名称不能为空 |
##### `request.transactional_limit_exceeded`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| German | Transaktionale writeTuples-Grenze überschritten: %count% Operationen (max. 100). Verwenden Sie den nicht-transaktionalen Modus oder teilen Sie in mehrere Anfragen auf. |
| English | Transactional writeTuples exceeded limit: %count% operations (max 100). Use non-transactional mode or split into multiple requests. |
| Spanish | WriteTuples transaccional excedió el límite: %count% operaciones (máx. 100). Use modo no transaccional o divida en múltiples solicitudes. |
| French | Limite de writeTuples transactionnel dépassée : %count% opérations (max 100). Utilisez le mode non transactionnel ou divisez en plusieurs requêtes. |
| Italian | writeTuples transazionale ha superato il limite: %count% operazioni (massimo 100). Usa la modalità non transazionale o dividi in più richieste. |
| Japanese | トランザクショナルwriteTuplesが制限を超えました: %count%個の操作(最大100個)。非トランザクショナルモードを使用するか、複数のリクエストに分割してください。 |
| Korean | 트랜잭션 writeTuples가 제한을 초과했습니다: %count%개 작업 (최대 100개). 비트랜잭션 모드를 사용하거나 여러 요청으로 분할하세요. |
| Dutch | Transactionele writeTuples heeft limiet overschreden: %count% operaties (max 100). Gebruik niet-transactionele modus of verdeel over meerdere verzoeken. |
| Portuguese (Brazilian) | WriteTuples transacional excedeu limite: %count% operações (máx 100). Use modo não-transacional ou divida em múltiplas requisições. |
| Russian | Транзакционный writeTuples превысил лимит: %count% операций (максимум 100). Используйте нетранзакционный режим или разделите на несколько запросов. |
| Swedish | Transaktionell writeTuples överskred gränsen: %count% operationer (max 100). Använd icke-transaktionellt läge eller dela upp i flera förfrågningar. |
| Turkish | İşlemsel writeTuples sınırı aştı: %count% işlem (maksimum 100). İşlemsel olmayan modu kullanın veya birden fazla isteğe bölün. |
| Ukrainian | Транзакційний writeTuples перевищив ліміт: %count% операцій (максимум 100). Використовуйте нетранзакційний режим або розділіть на кілька запитів. |
| Chinese (Simplified) | 事务性writeTuples超出限制:%count%个操作(最大100个)。请使用非事务模式或拆分为多个请求。 |
##### `request.type_empty`
| Locale | Translation |
| ---------------------- | -------------------------------- |
| German | Typ darf nicht leer sein |
| English | Type cannot be empty |
| Spanish | El tipo no puede estar vacío |
| French | Le type ne peut pas être vide |
| Italian | Il tipo non può essere vuoto |
| Japanese | タイプを空にすることはできません |
| Korean | 타입은 비어있을 수 없습니다 |
| Dutch | Type kan niet leeg zijn |
| Portuguese (Brazilian) | Tipo não pode estar vazio |
| Russian | Тип не может быть пустым |
| Swedish | Typ kan inte vara tom |
| Turkish | Tür boş olamaz |
| Ukrainian | Тип не може бути порожнім |
| Chinese (Simplified) | 类型不能为空 |
##### `request.user_empty`
| Locale | Translation |
| ---------------------- | ---------------------------------------- |
| German | Benutzer darf nicht leer sein |
| English | User cannot be empty |
| Spanish | El usuario no puede estar vacío |
| French | L'utilisateur ne peut pas être vide |
| Italian | L''utente non può essere vuoto |
| Japanese | ユーザーを空にすることはできません |
| Korean | 사용자는 비어있을 수 없습니다 |
| Dutch | Gebruiker kan niet leeg zijn |
| Portuguese (Brazilian) | Usuário não pode estar vazio |
| Russian | Пользователь не может быть пустым |
| Swedish | Användare kan inte vara tom |
| Turkish | Kullanıcı boş olamaz |
| Ukrainian | Користувач не може бути порожнім |
| Chinese (Simplified) | 用户不能为空 |
##### `response.unexpected_type`
| Locale | Translation |
| ---------------------- | ---------------------------------------- |
| German | Unerwarteter Antworttyp erhalten |
| English | Unexpected response type received |
| Spanish | Tipo de respuesta inesperado recibido |
| French | Type de réponse inattendu reçu |
| Italian | Tipo di risposta inaspettato ricevuto |
| Japanese | 予期しないレスポンスタイプを受信しました |
| Korean | 예상치 못한 응답 타입을 받았습니다 |
| Dutch | Onverwacht responstype ontvangen |
| Portuguese (Brazilian) | Tipo de resposta inesperado recebido |
| Russian | Получен неожиданный тип ответа |
| Swedish | Oväntad svarstyp mottagen |
| Turkish | Beklenmeyen yanıt türü alındı |
| Ukrainian | Отримано неочікуваний тип відповіді |
| Chinese (Simplified) | 收到意外的响应类型 |
##### `result.failure_no_value`
| Locale | Translation |
| ---------------------- | ----------------------------------- |
| German | Fehlschlag hat keinen Wert |
| English | Failure has no value |
| Spanish | El resultado fallido no tiene valor |
| French | L'échec n'a pas de valeur |
| Italian | Il fallimento non ha valore |
| Japanese | 失敗には値がありません |
| Korean | 실패에는 값이 없습니다 |
| Dutch | Falen heeft geen waarde |
| Portuguese (Brazilian) | Falha não tem valor |
| Russian | Неудача не имеет значения |
| Swedish | Misslyckande har inget värde |
| Turkish | Başarısızlığın değeri yok |
| Ukrainian | Невдача не має значення |
| Chinese (Simplified) | 失败没有值 |
##### `result.success_no_error`
| Locale | Translation |
| ---------------------- | ------------------------------------ |
| German | Erfolg hat keinen Fehler |
| English | Success has no error |
| Spanish | El resultado exitoso no tiene error |
| French | Le succès n'a pas d'erreur |
| Italian | Il successo non ha errori |
| Japanese | 成功にはエラーがありません |
| Korean | 성공에는 오류가 없습니다 |
| Dutch | Succes heeft geen fout |
| Portuguese (Brazilian) | Sucesso não tem erro |
| Russian | Успех не имеет ошибки |
| Swedish | Framgång har inget fel |
| Turkish | Başarının hatası yok |
| Ukrainian | Успіх не має помилки |
| Chinese (Simplified) | 成功没有错误 |
##### `schema.class_not_found`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------------------------------------------- |
| German | Klasse '%className%' existiert nicht oder kann nicht automatisch geladen werden |
| English | Class "%className%" does not exist or cannot be autoloaded |
| Spanish | La clase "%className%" no existe o no se puede cargar automáticamente |
| French | La classe "%className%" n''existe pas ou ne peut pas être chargée automatiquement |
| Italian | La classe "%className%" non esiste o non può essere auto-caricata |
| Japanese | クラス「%className%」は存在しないか、自動読み込みできません |
| Korean | 클래스 "%className%"가 존재하지 않거나 자동로드할 수 없습니다 |
| Dutch | Klasse "%className%" bestaat niet of kan niet automatisch geladen worden |
| Portuguese (Brazilian) | Classe "%className%" não existe ou não pode ser carregada automaticamente |
| Russian | Класс "%className%" не существует или не может быть автозагружен |
| Swedish | Klass "%className%" existerar inte eller kan inte autoladdas |
| Turkish | Sınıf "%className%" mevcut değil veya otomatik yüklenemiyor |
| Ukrainian | Клас "%className%" не існує або не може бути автозавантажений |
| Chinese (Simplified) | 类"%className%"不存在或无法自动加载 |
##### `schema.item_type_not_found`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| German | Elementtyp '%itemType%' existiert nicht oder kann nicht automatisch geladen werden |
| English | Item type "%itemType%" does not exist or cannot be autoloaded |
| Spanish | El tipo de elemento "%itemType%" no existe o no se puede cargar automáticamente |
| French | Le type d''élément "%itemType%" n''existe pas ou ne peut pas être chargé automatiquement |
| Italian | Il tipo di elemento "%itemType%" non esiste o non può essere auto-caricato |
| Japanese | アイテムタイプ「%itemType%」は存在しないか、自動読み込みできません |
| Korean | 항목 타입 "%itemType%"이 존재하지 않거나 자동로드할 수 없습니다 |
| Dutch | Itemtype "%itemType%" bestaat niet of kan niet automatisch geladen worden |
| Portuguese (Brazilian) | Tipo de item "%itemType%" não existe ou não pode ser carregado automaticamente |
| Russian | Тип элемента "%itemType%" не существует или не может быть автозагружен |
| Swedish | Objekttyp "%itemType%" existerar inte eller kan inte autoladdas |
| Turkish | Öğe türü "%itemType%" mevcut değil veya otomatik yüklenemiyor |
| Ukrainian | Тип елемента "%itemType%" не існує або не може бути автозавантажений |
| Chinese (Simplified) | 项目类型"%itemType%"不存在或无法自动加载 |
##### `exception.serialization.could_not_add_items_to_collection`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------ |
| German | Elemente konnten nicht zu Sammlung %className% hinzugefügt werden |
| English | Could not add items to collection %className% |
| Spanish | No se pudieron agregar elementos a la colección %className% |
| French | Impossible d'ajouter des éléments à la collection %className% |
| Italian | Impossibile aggiungere elementi alla collezione %className% |
| Japanese | コレクション%className%にアイテムを追加できませんでした |
| Korean | 컬렉션 %className%에 항목을 추가할 수 없습니다 |
| Dutch | Kon geen items toevoegen aan verzameling %className% |
| Portuguese (Brazilian) | Não foi possível adicionar itens à coleção %className% |
| Russian | Не удалось добавить элементы в коллекцию %className% |
| Swedish | Kunde inte lägga till objekt i samling %className% |
| Turkish | %className% koleksiyonuna öğeler eklenemedi |
| Ukrainian | Не вдалося додати елементи до колекції %className% |
| Chinese (Simplified) | 无法向集合%className%添加项目 |
##### `exception.serialization.empty_collection`
| Locale | Translation |
| ---------------------- | -------------------------------------- |
| German | Sammlung darf nicht leer sein |
| English | Collection cannot be empty |
| Spanish | La colección no puede estar vacía |
| French | La collection ne peut pas être vide |
| Italian | La collezione non può essere vuota |
| Japanese | コレクションを空にすることはできません |
| Korean | 컬렉션은 비어있을 수 없습니다 |
| Dutch | Verzameling kan niet leeg zijn |
| Portuguese (Brazilian) | Coleção não pode estar vazia |
| Russian | Коллекция не может быть пустой |
| Swedish | Samling kan inte vara tom |
| Turkish | Koleksiyon boş olamaz |
| Ukrainian | Колекція не може бути порожньою |
| Chinese (Simplified) | 集合不能为空 |
##### `exception.serialization.invalid_item_type`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------------------------------------------------- |
| German | Ungültiger Elementtyp für %property% in %className%: erwartet %expected%, erhalten %actual_type% |
| English | Invalid item type for %property% in %className%: expected %expected%, got %actual_type% |
| Spanish | Tipo de elemento inválido para %property% en %className%: se esperaba %expected%, se obtuvo %actual_type% |
| French | Type d'élément invalide pour %property% dans %className% : %expected% attendu, %actual_type% obtenu |
| Italian | Tipo di elemento non valido per %property% in %className%: atteso %expected%, ottenuto %actual_type% |
| Japanese | %className%の%property%に無効なアイテムタイプです: %expected%が期待されますが%actual_type%が取得されました |
| Korean | %className%의 %property%에 대한 잘못된 항목 타입: %expected%이 예상되지만 %actual_type%을 받았습니다 |
| Dutch | Ongeldig itemtype voor %property% in %className%: verwacht %expected%, kreeg %actual_type% |
| Portuguese (Brazilian) | Tipo de item inválido para %property% em %className%: esperado %expected%, obtido %actual_type% |
| Russian | Недопустимый тип элемента для %property% в %className%: ожидается %expected%, получено %actual_type% |
| Swedish | Ogiltig objekttyp för %property% i %className%: förväntad %expected%, fick %actual_type% |
| Turkish | %className% içindeki %property% için geçersiz öğe türü: %expected% bekleniyor, %actual_type% alındı |
| Ukrainian | Недійсний тип елемента для %property% в %className%: очікується %expected%, отримано %actual_type% |
| Chinese (Simplified) | %className%中%property%的项目类型无效:期望%expected%,得到%actual_type% |
##### `exception.serialization.missing_required_constructor_parameter`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------------------- |
| German | Erforderlicher Konstruktorparameter '%paramName%' für Klasse %className% fehlt |
| English | Missing required constructor parameter "%paramName%" for class %className% |
| Spanish | Falta el parámetro requerido del constructor "%paramName%" para la clase %className% |
| French | Paramètre de constructeur requis manquant "%paramName%" pour la classe %className% |
| Italian | Parametro del costruttore obbligatorio "%paramName%" mancante per la classe %className% |
| Japanese | クラス%className%の必須コンストラクターパラメーター「%paramName%」がありません |
| Korean | 클래스 %className%의 필수 생성자 매개변수 "%paramName%"이 누락되었습니다 |
| Dutch | Ontbrekende vereiste constructor parameter "%paramName%" voor klasse %className% |
| Portuguese (Brazilian) | Parâmetro obrigatório do construtor "%paramName%" faltando para classe %className% |
| Russian | Отсутствует обязательный параметр конструктора "%paramName%" для класса %className% |
| Swedish | Saknas obligatorisk konstruktorparameter "%paramName%" för klass %className% |
| Turkish | %className% sınıfı için gerekli yapıcı parametresi "%paramName%" eksik |
| Ukrainian | Відсутній обов'язковий параметр конструктора '%paramName%' для класу %className% |
| Chinese (Simplified) | 类%className%缺少必需的构造函数参数"%paramName%" |
##### `exception.serialization.response`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------- |
| German | Serialisierung/Deserialisierung der Antwortdaten fehlgeschlagen |
| English | Failed to serialize/deserialize response data |
| Spanish | No se pudieron serializar/deserializar los datos de respuesta |
| French | Échec de la sérialisation/désérialisation des données de réponse |
| Italian | Fallita la serializzazione/deserializzazione dei dati di risposta |
| Japanese | レスポンスデータのシリアライズ/デシリアライズに失敗しました |
| Korean | 응답 데이터 직렬화/역직렬화에 실패했습니다 |
| Dutch | Mislukt om responsdata te serialiseren/deserialiseren |
| Portuguese (Brazilian) | Falha ao serializar/deserializar dados de resposta |
| Russian | Не удалось сериализовать/десериализовать данные ответа |
| Swedish | Misslyckades med att serialisera/deserialisera svarsdata |
| Turkish | Yanıt verilerini serileştirme/deserileştirme başarısız |
| Ukrainian | Не вдалося серіалізувати/десеріалізувати дані відповіді |
| Chinese (Simplified) | 序列化/反序列化响应数据失败 |
##### `exception.serialization.undefined_item_type`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------- |
| German | Elementtyp ist für %className% nicht definiert |
| English | Item type is not defined for %className% |
| Spanish | El tipo de elemento no está definido para %className% |
| French | Le type d'élément n'est pas défini pour %className% |
| Italian | Tipo di elemento non definito per %className% |
| Japanese | %className%のアイテムタイプが定義されていません |
| Korean | %className%의 항목 타입이 정의되지 않았습니다 |
| Dutch | Itemtype is niet gedefinieerd voor %className% |
| Portuguese (Brazilian) | Tipo de item não está definido para %className% |
| Russian | Тип элемента не определен для %className% |
| Swedish | Objekttyp är inte definierad för %className% |
| Turkish | %className% için öğe türü tanımlanmamış |
| Ukrainian | Тип елемента не визначений для %className% |
| Chinese (Simplified) | %className%的项目类型未定义 |
##### `service.http_not_available`
| Locale | Translation |
| ---------------------- | -------------------------------- |
| German | HTTP-Service nicht verfügbar |
| English | HTTP service not available |
| Spanish | Servicio HTTP no disponible |
| French | Service HTTP non disponible |
| Italian | Servizio HTTP non disponibile |
| Japanese | HTTPサービスが利用できません |
| Korean | HTTP 서비스를 사용할 수 없습니다 |
| Dutch | HTTP-service niet beschikbaar |
| Portuguese (Brazilian) | Serviço HTTP não disponível |
| Russian | HTTP сервис недоступен |
| Swedish | HTTP-tjänst inte tillgänglig |
| Turkish | HTTP hizmeti kullanılamıyor |
| Ukrainian | HTTP сервіс недоступний |
| Chinese (Simplified) | HTTP服务不可用 |
##### `service.schema_validator_not_available`
| Locale | Translation |
| ---------------------- | ------------------------------------ |
| German | Schema-Validator nicht verfügbar |
| English | Schema validator not available |
| Spanish | Validador de esquema no disponible |
| French | Validateur de schéma non disponible |
| Italian | Validatore schema non disponibile |
| Japanese | スキーマバリデーターが利用できません |
| Korean | 스키마 검증기를 사용할 수 없습니다 |
| Dutch | Schema-validator niet beschikbaar |
| Portuguese (Brazilian) | Validador de schema não disponível |
| Russian | Валидатор схемы недоступен |
| Swedish | Schemavalidator inte tillgänglig |
| Turkish | Şema doğrulayıcı kullanılamıyor |
| Ukrainian | Валідатор схеми недоступний |
| Chinese (Simplified) | 模式验证器不可用 |
##### `service.store_repository_not_available`
| Locale | Translation |
| ---------------------- | ------------------------------------ |
| German | Store-Repository nicht verfügbar |
| English | Store repository not available |
| Spanish | Repositorio de almacén no disponible |
| French | Dépôt de magasin non disponible |
| Italian | Repository store non disponibile |
| Japanese | ストアリポジトリが利用できません |
| Korean | 스토어 저장소를 사용할 수 없습니다 |
| Dutch | Store-repository niet beschikbaar |
| Portuguese (Brazilian) | Repositório de store não disponível |
| Russian | Репозиторий хранилища недоступен |
| Swedish | Butiks-repository inte tillgängligt |
| Turkish | Mağaza deposu kullanılamıyor |
| Ukrainian | Репозиторій сховища недоступний |
| Chinese (Simplified) | 存储仓库不可用 |
##### `service.tuple_filter_not_available`
| Locale | Translation |
| ---------------------- | ------------------------------------------ |
| German | Tupel-Filter-Service nicht verfügbar |
| English | Tuple filter service not available |
| Spanish | Servicio de filtro de tuplas no disponible |
| French | Service de filtre de tuple non disponible |
| Italian | Servizio filtro tuple non disponibile |
| Japanese | タプルフィルターサービスが利用できません |
| Korean | 튜플 필터 서비스를 사용할 수 없습니다 |
| Dutch | Tuple-filterservice niet beschikbaar |
| Portuguese (Brazilian) | Serviço de filtro de tupla não disponível |
| Russian | Служба фильтра кортежей недоступна |
| Swedish | Tupel-filtertjänst inte tillgänglig |
| Turkish | Tuple filtre hizmeti kullanılamıyor |
| Ukrainian | Служба фільтра кортежів недоступна |
| Chinese (Simplified) | 元组过滤器服务不可用 |
##### `service.tuple_repository_not_available`
| Locale | Translation |
| ---------------------- | ----------------------------------- |
| German | Tupel-Repository nicht verfügbar |
| English | Tuple repository not available |
| Spanish | Repositorio de tuplas no disponible |
| French | Dépôt de tuple non disponible |
| Italian | Repository tuple non disponibile |
| Japanese | タプルリポジトリが利用できません |
| Korean | 튜플 저장소를 사용할 수 없습니다 |
| Dutch | Tuple-repository niet beschikbaar |
| Portuguese (Brazilian) | Repositório de tupla não disponível |
| Russian | Репозиторий кортежей недоступен |
| Swedish | Tupel-repository inte tillgängligt |
| Turkish | Tuple deposu kullanılamıyor |
| Ukrainian | Репозиторій кортежів недоступний |
| Chinese (Simplified) | 元组仓库不可用 |
##### `store.name_required`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------- |
| German | Store-Name ist erforderlich und darf nicht leer sein |
| English | Store name is required and cannot be empty |
| Spanish | El nombre del almacén es requerido y no puede estar vacío |
| French | Le nom du magasin est requis et ne peut pas être vide |
| Italian | Il nome dello store è obbligatorio e non può essere vuoto |
| Japanese | ストア名は必須で、空にすることはできません |
| Korean | 스토어 이름은 필수이며 비어있을 수 없습니다 |
| Dutch | Storenaam is vereist en kan niet leeg zijn |
| Portuguese (Brazilian) | Nome do store é obrigatório e não pode estar vazio |
| Russian | Имя хранилища обязательно и не может быть пустым |
| Swedish | Butiksnamn krävs och kan inte vara tomt |
| Turkish | Mağaza adı gereklidir ve boş olamaz |
| Ukrainian | Ім'я сховища обов'язкове і не може бути порожнім |
| Chinese (Simplified) | 存储名称是必需的,不能为空 |
##### `store.name_too_long`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------ |
| German | Store-Name überschreitet maximale Länge von %d Zeichen (bereitgestellt: %d) |
| English | Store name exceeds maximum length of %d characters (provided: %d) |
| Spanish | El nombre del almacén excede la longitud máxima de %d caracteres (proporcionado: %d) |
| French | Le nom du magasin dépasse la longueur maximale de %d caractères (fourni : %d) |
| Italian | Il nome dello store supera la lunghezza massima di %d caratteri (forniti: %d) |
| Japanese | ストア名が最大長%d文字を超えています(提供された文字数: %d) |
| Korean | 스토어 이름이 최대 길이 %d자를 초과했습니다 (제공됨: %d) |
| Dutch | Storenaam overschrijdt maximale lengte van %d karakters (verstrekt: %d) |
| Portuguese (Brazilian) | Nome do store excede comprimento máximo de %d caracteres (fornecido: %d) |
| Russian | Имя хранилища превышает максимальную длину в %d символов (предоставлено: %d) |
| Swedish | Butiksnamn överstiger maximal längd på %d tecken (tillhandahållet: %d) |
| Turkish | Mağaza adı %d karakter maksimum uzunluğunu aşıyor (sağlanan: %d) |
| Ukrainian | Ім'я сховища перевищує максимальну довжину %d символів (надано: %d) |
| Chinese (Simplified) | 存储名称超过最大长度%d个字符(提供:%d) |
##### `store.not_found`
| Locale | Translation |
| ---------------------- | ------------------------------------- |
| German | Store %s wurde nicht gefunden |
| English | Store %s was not found |
| Spanish | No se encontró el almacén %s |
| French | Le magasin %s n'a pas été trouvé |
| Italian | Store %s non trovato |
| Japanese | ストア%sが見つかりませんでした |
| Korean | 스토어 %s를 찾을 수 없습니다 |
| Dutch | Store %s niet gevonden |
| Portuguese (Brazilian) | Store %s não foi encontrado |
| Russian | Хранилище %s не найдено |
| Swedish | Butik %s hittades inte |
| Turkish | Mağaza %s bulunamadı |
| Ukrainian | Сховище %s не знайдено |
| Chinese (Simplified) | 未找到存储%s |
##### `translation.file_not_found`
| Locale | Translation |
| ---------------------- | ----------------------------------------------- |
| German | Übersetzungsdatei nicht gefunden: %resource% |
| English | Translation file not found: %resource% |
| Spanish | Archivo de traducción no encontrado: %resource% |
| French | Fichier de traduction non trouvé : %resource% |
| Italian | File di traduzione non trovato: %resource% |
| Japanese | 翻訳ファイルが見つかりません: %resource% |
| Korean | 번역 파일을 찾을 수 없습니다: %resource% |
| Dutch | Vertaalbestand niet gevonden: %resource% |
| Portuguese (Brazilian) | Arquivo de tradução não encontrado: %resource% |
| Russian | Файл перевода не найден: %resource% |
| Swedish | Översättningsfil hittades inte: %resource% |
| Turkish | Çeviri dosyası bulunamadı: %resource% |
| Ukrainian | Файл перекладу не знайдено: %resource% |
| Chinese (Simplified) | 未找到翻译文件:%resource% |
##### `translation.unsupported_format`
| Locale | Translation |
| ---------------------- | -------------------------------------------------------- |
| German | Nicht unterstütztes Übersetzungsdateiformat: %format% |
| English | Unsupported translation file format: %format% |
| Spanish | Formato de archivo de traducción no compatible: %format% |
| French | Format de fichier de traduction non supporté : %format% |
| Italian | Formato del file di traduzione non supportato: %format% |
| Japanese | サポートされていない翻訳ファイル形式です: %format% |
| Korean | 지원되지 않는 번역 파일 형식: %format% |
| Dutch | Niet ondersteund vertaalbestandformaat: %format% |
| Portuguese (Brazilian) | Formato de arquivo de tradução não suportado: %format% |
| Russian | Неподдерживаемый формат файла перевода: %format% |
| Swedish | Ostödd översättningsfilformat: %format% |
| Turkish | Desteklenmeyen çeviri dosya formatı: %format% |
| Ukrainian | Непідтримуваний формат файлу перекладу: %format% |
| Chinese (Simplified) | 不支持的翻译文件格式:%format% |
##### `tuple_operation.delete.description`
| Locale | Translation |
| ---------------------- | ----------------------------------------------------------------------------------------------- |
| German | Entfernt ein vorhandenes Beziehungstupel, widerruft Berechtigungen oder entfernt Beziehungen |
| English | Removes an existing relationship tuple, revoking permissions or removing relationships |
| Spanish | Elimina una tupla de relación existente, revocando permisos o eliminando relaciones |
| French | Supprime un tuple de relation existant, révoquant des permissions ou supprimant des relations |
| Italian | Rimuove una tupla di relazione esistente, revocando permessi o rimuovendo relazioni |
| Japanese | 既存の関係タプルを削除し、権限を取り消すか関係を削除します |
| Korean | 기존 관계 튜플을 제거하여 권한을 취소하거나 관계를 삭제합니다 |
| Dutch | Verwijdert een bestaande relatietuple, trekt machtigingen in of verwijdert relaties |
| Portuguese (Brazilian) | Remove uma tupla de relacionamento existente, revogando permissões ou removendo relacionamentos |
| Russian | Удаляет существующий кортеж отношений, отзывая разрешения или удаляя отношения |
| Swedish | Tar bort en befintlig relationstupel, återkallar behörigheter eller tar bort relationer |
| Turkish | Mevcut bir ilişki tuple kaldırır, izinleri iptal eder veya ilişkileri siler |
| Ukrainian | Видаляє існуючий кортеж відношень, відкликаючи дозволи або видаляючи відношення |
| Chinese (Simplified) | 删除现有的关系元组,撤销权限或移除关系 |
##### `tuple_operation.write.description`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------------------------------- |
| German | Fügt ein neues Beziehungstupel hinzu, gewährt Berechtigungen oder stellt Beziehungen her |
| English | Adds a new relationship tuple, granting permissions or establishing relationships |
| Spanish | Agrega una nueva tupla de relación, otorgando permisos o estableciendo relaciones |
| French | Ajoute un nouveau tuple de relation, accordant des permissions ou établissant des relations |
| Italian | Aggiunge una nuova tupla di relazione, concedendo permessi o stabilendo relazioni |
| Japanese | 新しい関係タプルを追加し、権限を付与するか関係を確立します |
| Korean | 새로운 관계 튜플을 추가하여 권한을 부여하거나 관계를 설정합니다 |
| Dutch | Voegt een nieuwe relatietuple toe, verleent machtigingen of vestigt relaties |
| Portuguese (Brazilian) | Adiciona uma nova tupla de relacionamento, concedendo permissões ou estabelecendo relacionamentos |
| Russian | Добавляет новый кортеж отношений, предоставляя разрешения или устанавливая отношения |
| Swedish | Lägger till en ny relationstupel, beviljar behörigheter eller etablerar relationer |
| Turkish | Yeni bir ilişki tuple ekler, izinler verir veya ilişkiler kurar |
| Ukrainian | Додає новий кортеж відношень, надаючи дозволи або встановлюючи відношення |
| Chinese (Simplified) | 添加新的关系元组,授予权限或建立关系 |
##### `yaml.cannot_read_file`
| Locale | Translation |
| ---------------------- | ------------------------------------------- |
| German | Datei kann nicht gelesen werden: %filename% |
| English | Cannot read file: %filename% |
| Spanish | No se puede leer el archivo: %filename% |
| French | Impossible de lire le fichier : %filename% |
| Italian | Impossibile leggere il file: %filename% |
| Japanese | ファイルを読み取れません: %filename% |
| Korean | 파일을 읽을 수 없습니다: %filename% |
| Dutch | Kan bestand niet lezen: %filename% |
| Portuguese (Brazilian) | Não é possível ler arquivo: %filename% |
| Russian | Невозможно прочитать файл: %filename% |
| Swedish | Kan inte läsa fil: %filename% |
| Turkish | Dosya okunamıyor: %filename% |
| Ukrainian | Неможливо прочитати файл: %filename% |
| Chinese (Simplified) | 无法读取文件:%filename% |
##### `yaml.file_does_not_exist`
| Locale | Translation |
| ---------------------- | ----------------------------------------- |
| German | Datei existiert nicht: %filename% |
| English | File does not exist: %filename% |
| Spanish | El archivo no existe: %filename% |
| French | Le fichier n'existe pas : %filename% |
| Italian | Il file non esiste: %filename% |
| Japanese | ファイルが存在しません: %filename% |
| Korean | 파일이 존재하지 않습니다: %filename% |
| Dutch | Bestand bestaat niet: %filename% |
| Portuguese (Brazilian) | Arquivo não existe: %filename% |
| Russian | Файл не существует: %filename% |
| Swedish | Filen existerar inte: %filename% |
| Turkish | Dosya mevcut değil: %filename% |
| Ukrainian | Файл не існує: %filename% |
| Chinese (Simplified) | 文件不存在:%filename% |
##### `yaml.invalid_structure`
| Locale | Translation |
| ---------------------- | --------------------------------------------------- |
| German | Ungültige YAML-Struktur in Zeile %line_number% |
| English | Invalid YAML structure on line %line_number% |
| Spanish | Estructura YAML inválida en la línea %line_number% |
| French | Structure YAML invalide à la ligne %line_number% |
| Italian | Struttura YAML non valida alla riga %line_number% |
| Japanese | 行%line_number%のYAML構造が無効です |
| Korean | %line_number%번째 줄의 YAML 구조가 잘못되었습니다 |
| Dutch | Ongeldige YAML-structuur op regel %line_number% |
| Portuguese (Brazilian) | Estrutura YAML inválida na linha %line_number% |
| Russian | Недопустимая структура YAML на строке %line_number% |
| Swedish | Ogiltig YAML-struktur på rad %line_number% |
| Turkish | %line_number% satırında geçersiz YAML yapısı |
| Ukrainian | Недійсна структура YAML на рядку %line_number% |
| Chinese (Simplified) | 第%line_number%行YAML结构无效 |
##### `yaml.invalid_syntax_empty_key`
| Locale | Translation |
| ---------------------- | ---------------------------------------------------------------- |
| German | Ungültige YAML-Syntax in Zeile %line_number%: leerer Schlüssel |
| English | Invalid YAML syntax on line %line_number%: empty key |
| Spanish | Sintaxis YAML inválida en la línea %line_number%: clave vacía |
| French | Syntaxe YAML invalide à la ligne %line_number% : clé vide |
| Italian | Sintassi YAML non valida alla riga %line_number%: chiave vuota |
| Japanese | 行%line_number%のYAML構文が無効です: キーが空です |
| Korean | %line_number%번째 줄의 YAML 구문이 잘못되었습니다: 빈 키 |
| Dutch | Ongeldige YAML-syntaxis op regel %line_number%: lege sleutel |
| Portuguese (Brazilian) | Sintaxe YAML inválida na linha %line_number%: chave vazia |
| Russian | Недопустимый синтаксис YAML на строке %line_number%: пустой ключ |
| Swedish | Ogiltig YAML-syntax på rad %line_number%: tom nyckel |
| Turkish | %line_number% satırında geçersiz YAML sözdizimi: boş anahtar |
| Ukrainian | Недійсний синтаксис YAML на рядку %line_number%: порожній ключ |
| Chinese (Simplified) | 第%line_number%行YAML语法无效:空键 |
##### `yaml.invalid_syntax_missing_colon`
| Locale | Translation |
| ---------------------- | -------------------------------------------------------------------------- |
| German | Ungültige YAML-Syntax in Zeile %line_number%: fehlender Doppelpunkt |
| English | Invalid YAML syntax on line %line_number%: missing colon |
| Spanish | Sintaxis YAML inválida en la línea %line_number%: falta dos puntos |
| French | Syntaxe YAML invalide à la ligne %line_number% : deux-points manquants |
| Italian | Sintassi YAML non valida alla riga %line_number%: due punti mancanti |
| Japanese | 行%line_number%のYAML構文が無効です: コロンがありません |
| Korean | %line_number%번째 줄의 YAML 구문이 잘못되었습니다: 콜론 누락 |
| Dutch | Ongeldige YAML-syntaxis op regel %line_number%: ontbrekende dubbele punt |
| Portuguese (Brazilian) | Sintaxe YAML inválida na linha %line_number%: dois pontos faltando |
| Russian | Недопустимый синтаксис YAML на строке %line_number%: отсутствует двоеточие |
| Swedish | Ogiltig YAML-syntax på rad %line_number%: saknar kolon |
| Turkish | %line_number% satırında geçersiz YAML sözdizimi: iki nokta eksik |
| Ukrainian | Недійсний синтаксис YAML на рядку %line_number%: відсутня двокрапка |
| Chinese (Simplified) | 第%line_number%行YAML语法无效:缺少冒号 |
##### `yaml.invalid_syntax_missing_value`
| Locale | Translation |
| ---------------------- | ------------------------------------------------------------------------- |
| German | Ungültige YAML-Syntax in Zeile %line_number%: fehlender Wert |
| English | Invalid YAML syntax on line %line_number%: missing value |
| Spanish | Sintaxis YAML inválida en la línea %line_number%: falta valor |
| French | Syntaxe YAML invalide à la ligne %line_number% : valeur manquante |
| Italian | Sintassi YAML non valida alla riga %line_number%: valore mancante |
| Japanese | 行%line_number%のYAML構文が無効です: 値がありません |
| Korean | %line_number%번째 줄의 YAML 구문이 잘못되었습니다: 값 누락 |
| Dutch | Ongeldige YAML-syntaxis op regel %line_number%: ontbrekende waarde |
| Portuguese (Brazilian) | Sintaxe YAML inválida na linha %line_number%: valor faltando |
| Russian | Недопустимый синтаксис YAML на строке %line_number%: отсутствует значение |
| Swedish | Ogiltig YAML-syntax på rad %line_number%: saknar värde |
| Turkish | %line_number% satırında geçersiz YAML sözdizimi: değer eksik |
| Ukrainian | Недійсний синтаксис YAML на рядку %line_number%: відсутнє значення |
| Chinese (Simplified) | 第%line_number%行YAML语法无效:缺少值 |
#### Methods
##### key
```php
public function key(): string
```
Get the translation key for this message.
[View source](https://github.com/evansims/openfga-php/blob/main/src/Messages.php#L369)
###### Returns
`string`
<!-- End of evansims/openfga-php/docs/API/Messages.md -->
<!-- Source: evansims/openfga-php/docs/API/README.md -->
## OpenFGA SDK
**Total Components:** 6
### Subdirectories
| Directory | Description |
|-----------|-------------|
| [`Authentication`](https://github.com/evansims/openfga-php/blob/main/./Authentication/README.md) | Authentication providers and token management for OpenFGA API access. |
| [`Context`](https://github.com/evansims/openfga-php/blob/main/./Context/README.md) | |
| [`Events`](https://github.com/evansims/openfga-php/blob/main/./Events/README.md) | Event system for cross-cutting concerns like logging and metrics collection. |
| [`Exceptions`](https://github.com/evansims/openfga-php/blob/main/./Exceptions/README.md) | Exception hierarchy for type-safe error handling throughout the SDK. |
| [`Integration`](https://github.com/evansims/openfga-php/blob/main/./Integration/README.md) | Framework integration helpers and service providers. |
| [`Models`](https://github.com/evansims/openfga-php/blob/main/./Models/README.md) | Domain models representing OpenFGA entities like stores, tuples, and authorization models. |
| [`Network`](https://github.com/evansims/openfga-php/blob/main/./Network/README.md) | HTTP client abstractions, retry strategies, and low-level networking components. |
| [`Observability`](https://github.com/evansims/openfga-php/blob/main/./Observability/README.md) | Telemetry providers and monitoring integrations for operational visibility. |
| [`Repositories`](https://github.com/evansims/openfga-php/blob/main/./Repositories/README.md) | Data access interfaces and implementations for managing OpenFGA resources. |
| [`Requests`](https://github.com/evansims/openfga-php/blob/main/./Requests/README.md) | Request objects for all OpenFGA API operations. |
| [`Responses`](https://github.com/evansims/openfga-php/blob/main/./Responses/README.md) | Response objects containing API results and metadata. |
| [`Results`](https://github.com/evansims/openfga-php/blob/main/./Results/README.md) | Result pattern implementation for functional error handling without exceptions. |
| [`Schemas`](https://github.com/evansims/openfga-php/blob/main/./Schemas/README.md) | JSON schema validation for ensuring data integrity and type safety. |
| [`Services`](https://github.com/evansims/openfga-php/blob/main/./Services/README.md) | Business logic services that orchestrate between repositories and external systems. |
| [`Translation`](https://github.com/evansims/openfga-php/blob/main/./Translation/README.md) | Internationalization support and message translation utilities. |
### Interfaces
| Name | Description |
|------|-------------|
| [`ClientInterface`](https://github.com/evansims/openfga-php/blob/main/./ClientInterface.md) | OpenFGA Client Interface for relationship-based access control operations. This interface defines... |
| [`TransformerInterface`](https://github.com/evansims/openfga-php/blob/main/./TransformerInterface.md) | OpenFGA DSL Transformer Interface for authorization model conversions. This interface defines met... |
### Classes
| Name | Description |
|------|-------------|
| [`Client`](https://github.com/evansims/openfga-php/blob/main/./Client.md) | OpenFGA Client implementation for relationship-based access control operations. This client provi... |
| [`Transformer`](https://github.com/evansims/openfga-php/blob/main/./Transformer.md) | OpenFGA DSL Transformer implementation for authorization model conversions. This class provides c... |
### Enumerations
| Name | Description |
|------|-------------|
| [`Language`](https://github.com/evansims/openfga-php/blob/main/./Language.md) | Supported languages for OpenFGA SDK internationalization. This enum represents all available lang... |
| [`Messages`](https://github.com/evansims/openfga-php/blob/main/./Messages.md) | Centralized message keys for all exception messages in the OpenFGA PHP SDK. This enum provides ty... |
<!-- End of evansims/openfga-php/docs/API/README.md -->
<!-- Source: evansims/openfga-php/docs/API/Transformer.md -->
### Transformer
OpenFGA DSL Transformer implementation for authorization model conversions. This class provides complete implementation for converting between OpenFGA's Domain Specific Language (DSL) format and structured authorization model objects. It supports complex relationship definitions including unions, intersections, exclusions, and computed usersets with proper precedence handling. The transformer parses DSL syntax including: - Type definitions with relations - Direct user assignments [user, organization#member] - Computed usersets (owner, administrator) - Tuple-to-userset relations (owner from parent) - Boolean operations (and, or, but not) - Parenthetical grouping for precedence
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Implements](#implements)
- [Related Classes](#related-classes)
- [Methods](#methods)
- [`fromDsl()`](#fromdsl)
- [`toDsl()`](#todsl)
</details>
#### Namespace
`OpenFGA`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/Transformer.php)
#### Implements
- [`TransformerInterface`](https://github.com/evansims/openfga-php/blob/main/TransformerInterface.md)
#### Related Classes
- [TransformerInterface](https://github.com/evansims/openfga-php/blob/main/TransformerInterface.md) (interface)
#### Methods
##### fromDsl
*<small>Implements TransformerInterface</small>*
```php
public function fromDsl(string $dsl, SchemaValidatorInterface $validator): AuthorizationModelInterface
```
Parse a DSL string into an authorization model. This method converts a human-readable DSL (Domain Specific Language) string into a structured authorization model object that can be used with the OpenFGA API. The DSL provides an intuitive way to define authorization relationships and permissions using familiar syntax.
[View source](https://github.com/evansims/openfga-php/blob/main/src/TransformerInterface.php#L44)
###### Parameters
| Name | Type | Description |
| ------------ | -------------------------- | ------------------------------------------------------------ |
| `$dsl` | `string` | The DSL string containing the authorization model definition |
| `$validator` | `SchemaValidatorInterface` | Schema validator for validating the parsed model structure |
###### Returns
[`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) — The parsed authorization model ready for API operations
##### toDsl
*<small>Implements TransformerInterface</small>*
```php
public function toDsl(AuthorizationModelInterface $model): string
```
Convert an authorization model to its DSL string representation. This method transforms a structured authorization model object back into its human-readable DSL format, making it easy to review, edit, or share authorization model definitions. The output can be saved to files, version controlled, or used for documentation purposes.
[View source](https://github.com/evansims/openfga-php/blob/main/src/TransformerInterface.php#L59)
###### Parameters
| Name | Type | Description |
| -------- | ---------------------------------------------------------------------- | ------------------------------------------------ |
| `$model` | [`AuthorizationModelInterface`](https://github.com/evansims/openfga-php/blob/main/Models/AuthorizationModelInterface.md) | The authorization model to convert to DSL format |
###### Returns
`string` — The DSL string representation of the authorization model
<!-- End of evansims/openfga-php/docs/API/Transformer.md -->
<!-- Source: evansims/openfga-php/docs/API/TransformerInterface.md -->
### TransformerInterface
OpenFGA DSL Transformer Interface for authorization model conversions. This interface defines methods for converting between OpenFGA's Domain Specific Language (DSL) format and structured authorization model objects. The DSL provides a human-readable way to define authorization relationships and permissions that can be easily reviewed, edited, and version controlled. The transformer supports bidirectional conversion, allowing models to be defined in DSL format and then converted to API objects, or existing models to be exported back to DSL format for documentation and review purposes.
<details>
<summary><strong>Table of Contents</strong></summary>
- [Namespace](#namespace)
- [Source](#source)
- [Related Classes](#related-classes)
</details>
#### Namespace
`OpenFGA`
#### Source
[View source code](https://github.com/evansims/openfga-php/blob/main/src/TransformerInterface.php)
#### Related Classes
- [Transformer](https://github.com/evansims/openfga-php/blob/main/Transformer.md) (implementation)
<!-- End of evansims/openfga-php/docs/API/TransformerInterface.md -->
<!-- Source: evansims/openfga-php/docs/Essentials/Assertions.md -->
**Assertions can be thought of as unit tests for your permission system.** They let you define what should and shouldn't be allowed, then verify your authorization model works correctly before deploying it to production.
#### Prerequisites
Before working with assertions, ensure you have the following setup:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-setup.php)
#### What are assertions
Assertions are test cases that specify expected outcomes for permission checks. Each assertion says "user X should (or shouldn't) have permission Y on resource Z" and verifies this against your authorization model.
#### Writing your first test
Let's say you're building a document management system. You want to test that owners can edit documents but viewers cannot:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-basic.php#quickstart)
#### Testing permission inheritance
Complex authorization models often have inherited permissions. Test these relationships to ensure they work as expected:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-basic.php#inheritance)
#### Testing edge cases
Test boundary conditions and special cases in your permission model:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-basic.php#edge-cases)
#### Managing test data
Organize your assertions logically and keep them maintainable:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-test-class.php#intro)
#### Best practices
**Start with critical paths**: test the most important permission checks first - admin access, user data privacy, billing permissions.
**Test both positive and negative cases**: don't just test what should work, test what should be blocked.
**Use realistic data**: test with actual user IDs, resource names, and permission types from your application.
**Update tests when models change**: assertions should evolve with your authorization model. Treat them like any other test suite.
**Validate before deployment**: run assertions in your CI/CD pipeline to catch permission regressions before they reach production.
#### CI/CD Integration
Integrate assertion testing into your deployment pipeline to catch permission regressions before they reach production.
##### GitHub actions example
```yaml
# .github/workflows/authorization-tests.yml
name: Authorization Model Tests
on:
push:
paths:
- "authorization-models/**"
- "tests/authorization/**"
pull_request:
paths:
- "authorization-models/**"
- "tests/authorization/**"
jobs:
test-authorization:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
- name: Install dependencies
run: composer install --no-dev --optimize-autoloader
- name: Start OpenFGA Server
run: |
docker run -d --name openfga \
-p 8080:8080 \
openfga/openfga:latest \
run --playground-enabled
- name: Wait for OpenFGA
run: |
timeout 30 bash -c 'until curl -f http://localhost:8080/healthz; do sleep 1; done'
- name: Run Authorization Tests
run: php tests/authorization/run-assertions.php
env:
FGA_API_URL: http://localhost:8080
```
##### Test runner script
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-test-runner.php)
##### Model assertions file example
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-model-file.php)
##### Integration with Testing Frameworks
###### PHPUnit Integration
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-phpunit.php)
##### Docker Compose for Local Testing
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/assertions-docker-compose.yml)
Run with: `docker-compose -f docker-compose.test.yml up --build`
Remember: assertions replace all existing tests for a model when you call `writeAssertions()`. Always include your complete test suite in each call.
<!-- End of evansims/openfga-php/docs/Essentials/Assertions.md -->
<!-- Source: evansims/openfga-php/docs/Essentials/Models.md -->
**Authorization models are your permission blueprint.** They define what types of things exist in your system and how they relate to each other. Think database schema, but for permissions.
#### Prerequisites
The examples in this guide assume you have the following setup:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-setup.php)
#### Building your first model
Let's jump right into building a document sharing system. Here's what we want:
- Users can own, edit, or view documents
- Owners can do everything
- Editors can edit and view
- Viewers can only view
We'll define this model using OpenFGA's [DSL](https://openfga.dev/docs/configuration-language) format:
```yaml
model
schema 1.1
type user
type document
relations
define owner: [user]
define editor: [user] or owner
define viewer: [user] or editor
```
The `or` keyword creates inheritance - owners automatically become editors, and editors automatically become viewers.
#### Creating your model
Use the SDK's `dsl` [helper](https://github.com/evansims/openfga-php/blob/main/../Features/Helpers.md) to create a model, then use the `model` [helper](https://github.com/evansims/openfga-php/blob/main/../Features/Helpers.md) to commit the model to the OpenFGA server:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-dsl.php#dsl)
Save that returned `$modelId`—you'll need it for future API calls.
#### Common patterns
##### Direct assignment
The simplest relationship - a user directly has a role:
```yaml
type document
relations
define owner: [user]
```
This lets you write tuples like `user:alice owner document:readme`.
##### Computed relations
Relations that inherit from other relations:
```yaml
type document
relations
define owner: [user]
define editor: owner // All owners are editors
define viewer: editor // All editors are viewers
```
##### Union relations
Multiple ways to get the same permission:
```yaml
type document
relations
define owner: [user]
define editor: [user] or owner // Direct editors OR owners
define viewer: [user] or editor // Direct viewers OR editors
```
##### Hierarchical permissions
Inherit permissions from parent objects:
```yaml
type folder
relations
define owner: [user]
define viewer: [user] or owner
type document
relations
define parent: [folder]
define owner: [user]
define viewer: [user] or owner or viewer from parent
```
Now documents inherit viewer permissions from their parent folder.
##### Group membership
Users belong to groups, groups have permissions:
```yaml
type user
type group
relations
define member: [user]
type document
relations
define owner: [user, group#member]
define viewer: [user, group#member] or owner
```
The `group#member` syntax means "users who are members of the group."
#### Working with conditions
Add context-aware permissions using conditions:
```yaml
type document
relations
define viewer: [user with valid_ip]
define editor: [user with business_hours]
```
Define conditions when creating your model:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-conditions.php#conditions)
#### Using models in your application
##### Check permissions
The `allowed` [helper](https://github.com/evansims/openfga-php/blob/main/../Features/Helpers.md#checking-permissions) provides a convenient shorthand for checking permissions, and returns a boolean:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-permissions.php#allowed)
If you need greater control over the operation, use the Client `check` method directly:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-permissions.php#client)
##### List user's objects
The `objects` [helper](https://github.com/evansims/openfga-php/blob/main/../Features/Helpers.md) provides a convenient shorthand for listing user's objects, and returns an array of object identifiers:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-list-objects.php#helper)
If you need greater control over the operation, use the Client `streamedListObjects` or `listObjects` methods directly:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-list-objects.php#client)
#### Advanced patterns
##### Multi-tenant systems
Each tenant has their own workspace:
```yaml
type user
type tenant
relations
define member: [user]
define admin: [user]
type document
relations
define tenant: [tenant]
define owner: [user] and member from tenant
define viewer: [user] and member from tenant
```
The `and` keyword requires both conditions - users must be both assigned the role AND be members of the tenant.
##### Approval workflows
Documents need approval before publishing:
```yaml
type document
relations
define owner: [user]
define editor: [user] or owner
define approver: [user]
define can_publish: approver and owner
define viewer: [user] or can_publish
```
##### Time-based access
```yaml
type document
relations
define owner: [user]
define viewer: [user with during_work_hours] or owner
```
##### Nested resources
Permissions flow down through resource hierarchies:
```yaml
type organization
relations
define admin: [user]
define member: [user] or admin
type project
relations
define organization: [organization]
define admin: [user] or admin from organization
define member: [user] or member from organization
type document
relations
define project: [project]
define editor: [user] or admin from project
define viewer: [user] or member from project
```
#### Managing models
##### List all models
The `models` helper provides a convenient, self-paginated method for retrieving all the authorization models in a store:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-list-all.php#helper)
Alternatively you can call the Client `listAuthorizationModels` method directly:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-list-all.php#client)
##### Get a specific model
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/models-list-all.php#specific)
#### Troubleshooting common issues
##### "My permissions aren't working as expected"
- Use [`expand()`](https://github.com/evansims/openfga-php/blob/main/Queries.md) to see the permission tree
- Check if you're using the correct model ID in your checks
- Verify your authorization model DSL syntax
##### "Users have too many permissions"
- Check for unintended `or` relationships in your model
- Review inheritance patterns - owners might inherit editor/viewer permissions
- Use [assertions](https://github.com/evansims/openfga-php/blob/main/Assertions.md) to test expected vs actual permissions
##### "Users don't have enough permissions"
- Verify relationships are written correctly as [tuples](https://github.com/evansims/openfga-php/blob/main/Tuples.md)
- Check if you're [querying](https://github.com/evansims/openfga-php/blob/main/Queries.md) with the right object/relation names
- Use [`readTuples()`](https://github.com/evansims/openfga-php/blob/main/Tuples.md#reading-existing-permissions) to see what permissions exist
#### What's next
Once you've created your authorization model, it's crucial to test it thoroughly. The [Assertions guide](https://github.com/evansims/openfga-php/blob/main/Assertions.md) shows you how to write comprehensive tests for your authorization models, ensuring they behave exactly as expected before deploying to production.
<!-- End of evansims/openfga-php/docs/Essentials/Models.md -->
<!-- Source: evansims/openfga-php/docs/Essentials/Queries.md -->
**Queries are how your application enforces access control.** With an [authorization model](https://github.com/evansims/openfga-php/blob/main/Models.md) and [relationship tuples](https://github.com/evansims/openfga-php/blob/main/Tuples.md) in place, it's time to put them to use.
#### Prerequisites
Before diving into the examples, make sure you have the necessary setup:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-setup.php)
#### Queries
Queries let you ask OpenFGA about permissions. There are four types:
- **Check permissions**<br />
"Can Alice edit this document?"
- **List accessible objects**<br />
"What documents can Alice edit?"
- **Find users with permission**<br />
"Who can edit this document?"
- **Expand relationships**<br />
"How does Alice have edit access?"
##### Check permissions
This is the query your application will make most often. Use the `allowed` [helper](https://github.com/evansims/openfga-php/blob/main/../Features/Helpers.md) to check permissions and return a boolean value:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-check.php#helper)
> The `allowed` helper wraps the Client `check` method, and is intended for situations where graceful degradation is preferred over exception handling. It will silently ignore errors and return `false` if the request fails.
<details>
<summary>Use the Client <code>check</code> method if you need more control over the operation…</summary>
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-check.php#client)
</details>
###### Check multiple permissions at once
Use the `checks` helper to check multiple permissions at once:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-batch-check.php#helper)
> The `checks` helper wraps the Client `batchCheck` method, and is intended for situations where graceful degradation is preferred over exception handling. It will silently ignore errors.
<details>
<summary>Use the Client <code>batchCheck</code> method directly if you need more control over the operation…</summary>
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-batch-check.php#client)
</details>
##### List accessible objects
Use the `objects` helper to retrieve a list of objects a user can access.
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-list-objects.php#helper)
> The `objects` helper wraps the Client `streamedListObjects` method and is intended for situations where graceful degradation is preferred over exception handling. It will silently ignore errors.
<details>
<summary>Use the Client <code>streamedListObjects</code> or <code>listObjects</code> methods directly if you need more control over the operation…</summary>
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-list-objects.php#client)
</details>
##### Find users with permission
Use the `users` helper to retrieve a list of users who have a specific permission on an object.
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-list-users.php#helper)
> The `users` helper wraps the Client `listUsers` method and is intended for situations where graceful degradation is preferred over exception handling. It will silently ignore errors.
<details>
<summary>Use the Client <code>listUsers</code> method directly if you need more control over the operation…</summary>
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-list-users.php#client)
</details>
##### Expand relationships
When permissions aren't working as expected, use the Client `expand` method to discover why. It returns the complete relationship tree, and is useful for debugging complex permission structures or understanding why a user has (or doesn't have) access.
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-expand.php#client)
#### Advanced patterns
##### Contextual tuples
Test "what-if" scenarios without permanently saving relationships. Perfect for previewing permission changes.
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-contextual.php#client)
##### Consistency levels
For read-after-write scenarios, you might need stronger consistency:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-consistency.php#consistency)
###### Advanced error handling
Use enum-based exceptions for more precise error handling with i18n support:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-advanced.php#error-handling)
#### Common Query Patterns
##### Permission gates for routes
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-advanced.php#permission-gates)
##### Efficient data filtering
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-advanced.php#data-filtering)
##### Debugging permission issues
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/queries-advanced.php#debugging)
<!-- End of evansims/openfga-php/docs/Essentials/Queries.md -->
<!-- Source: evansims/openfga-php/docs/Essentials/Stores.md -->
**Stores can be thought of as your authorization database.** They contain your permission rules, user relationships, and everything needed to answer "can this user do that?" Every OpenFGA operation happens within a store, making them the foundation of your authorization system.
#### Prerequisites
The examples in this guide assume you have the following setup:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/stores-setup.php)
#### Single application setup
For a typical application, create one store per environment:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/stores-basic.php#usage)
Save the store ID in your environment configuration. You'll need it for future API calls.
#### Multi-tenant patterns
For SaaS applications, create a store per customer to ensure complete data isolation:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/stores-multi-tenant.php#usage)
#### Environment separation
Keep your environments completely isolated:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/stores-management.php#seperation)
#### Store management
Finding and managing existing stores:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/stores-management.php#management)
For pagination with many stores:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/stores-management.php#pagination)
#### Best practices
**When to use multiple stores:**
- Different environments (dev/staging/production)
- Different customers in SaaS apps
- Different applications with no shared permissions
- Compliance requirements
**When to use a single store:**
- Different user roles (use authorization models instead)
- Different features in the same app (use object types)
- A/B testing (use different object IDs)
**Pro tips:**
- Start with one store per environment
- Save store IDs in your configuration
- Test your app works with store switching
- Document which team owns each store
<!-- End of evansims/openfga-php/docs/Essentials/Stores.md -->
<!-- Source: evansims/openfga-php/docs/Essentials/Tuples.md -->
**Relationship tuples are where the rubber meets the road.** They're the actual permissions in your system - they define who can do what to which resource.
#### Prerequisites
The examples in this guide assume you have the following setup:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-setup.php)
#### Granting permissions
Use the `write` helper to give someone access:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-basic.php#write)
#### Removing permissions
Use the `delete` helper to take away access:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-basic.php#delete)
#### Bulk operations
Use the `writes` helper to handle multiple permission changes in one transaction:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-bulk.php#helper)
#### Reading existing permissions
Use the `read` [helper](https://github.com/evansims/openfga-php/blob/main/../Features/Helpers.md) to check what permissions exist:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-reading.php#helper)
Alternatively, use the Client's `readTuples` method for more control:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-reading.php#client)
#### Advanced patterns
##### Conditional tuples
Use conditions to make permissions context-dependent:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-conditions.php#write)
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-conditions.php#check)
##### Auditing changes
Monitor permission changes over time for auditing:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-auditing.php#auditing)
##### Working with groups
Use the `write` helper to grant permissions to groups instead of individual users:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-groups.php#groups)
Now Anne can edit the technical specs because she's a member of the engineering team.
For checking permissions and querying relationships, see [Queries](https://github.com/evansims/openfga-php/blob/main/Queries.md).
#### Error handling with tuples
The SDK has a powerful enum-based exception handling system that allows you to handle errors in a type-safe way.
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-error-handling.php#error-handling)
##### Supporting multiple languages
The error messages from tuple operations will automatically use the language configured in your client:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/tuples-multilang.php)
#### What's next
After writing tuples to grant permissions, you'll want to verify those permissions are working correctly. The [Queries](https://github.com/evansims/openfga-php/blob/main/Queries.md) guide covers how to check permissions, list user access, and discover relationships using the tuples you've created.
<!-- End of evansims/openfga-php/docs/Essentials/Tuples.md -->
<!-- Source: evansims/openfga-php/docs/Features/Concurrency.md -->
Learn how to leverage the OpenFGA PHP SDK's powerful concurrency features to dramatically improve performance when working with large-scale authorization operations. This guide covers async patterns, fiber-based parallelism, and bulk write operations that can speed up your authorization workflows by orders of magnitude.
#### Prerequisites
All examples in this guide assume you have the following setup:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/concurrency-setup.php)
With this setup established, the examples below focus on the concurrency features without repetitive boilerplate.
#### Quickstart
Transform slow sequential operations into blazing-fast parallel executions with just a few configuration changes:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/concurrency-parallel.php#parallelism)
#### Core concepts
##### Why concurrency matters
When managing thousands or millions of authorization tuples, sequential processing becomes a bottleneck. The SDK's concurrency features let you:
- **Reduce latency** by processing multiple operations simultaneously
- **Maximize throughput** with configurable parallelism levels
- **Handle failures gracefully** without losing successful operations
- **Scale efficiently** while respecting API rate limits
##### PHP Fibers: Modern async without the complexity
The SDK uses PHP 8.1+ Fibers to provide true concurrency without the complexity of promises or callbacks. Fibers allow cooperative multitasking where operations yield control when waiting for I/O, enabling other operations to proceed.
#### Bulk write operations
Use the `writes` helper function or `writeTuples` method to process large sets of tuple operations efficiently:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/concurrency-bulk-basic.php#helper)
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/concurrency-bulk-basic.php#api)
##### Configuration options
Fine-tune bulk write behavior for your specific needs:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/concurrency-bulk-config.php#config)
#### Parallel processing patterns
##### Optimal parallelism levels
Choose parallelism based on your infrastructure and requirements:
```php
use function OpenFGA\{tuple, tuples, writes};
// Conservative: Good for shared environments
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxParallelRequests: 3
);
// Moderate: Balanced performance
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxParallelRequests: 5
);
// Aggressive: Maximum throughput
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxParallelRequests: 10
);
```
#### Error handling and resilience
##### Partial success handling
In non-transactional mode (which the `writes` helper defaults to) the SDK will continue processing even when some operations fail:
```php
use function OpenFGA\{tuple, tuples, writes};
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxRetries: 3, // Retry failed chunks
stopOnFirstError: false // Don't stop on first failure
);
if ($result->hasErrors()) {
echo "Completed with {$result->getFailedChunks()} failed chunks\n";
echo "Successfully processed: {$result->getSuccessfulOperations()} tuples\n";
foreach ($result->getErrors() as $error) {
error_log("Chunk failed: " . $error->getMessage());
}
}
```
##### Retry strategies
Configure retry behavior for transient failures:
```php
use function OpenFGA\{tuple, tuples, writes};
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxRetries: 3, // Retry up to 3 times
retryDelaySeconds: 1.0, // Start with 1 second delay
maxParallelRequests: 5
);
// The SDK uses exponential backoff:
// - First retry: 1 second delay
// - Second retry: 2 second delay
// - Third retry: 4 second delay
```
#### Integration with async frameworks
##### Using with ReactPHP
While the SDK uses native PHP Fibers, you can integrate it with async frameworks:
```php
use function OpenFGA\{tuple, tuples, writes};
use React\EventLoop\Loop;
use React\Promise\Promise;
// Wrap SDK calls in promises
function batchTuplesAsync($client, $storeId, $modelId, $writes, $deletes, $options = []) {
return new Promise(function ($resolve, $reject) use ($client, $storeId, $modelId, $writes, $deletes, $options) {
Loop::futureTick(function () use ($resolve, $reject, $client, $storeId, $modelId, $writes, $deletes, $options) {
try {
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $writes,
deletes: $deletes,
maxParallelRequests: $options['maxParallelRequests'] ?? 1
);
$resolve($result);
} catch (\Exception $e) {
$reject($e);
}
});
});
}
// Use in async context
batchTuplesAsync($client, $storeId, $modelId, $writes, $deletes, ['maxParallelRequests' => 10])
->then(function ($result) {
echo "Batch completed: {$result->getSuccessfulOperations()} operations\n";
})
->catch(function ($error) {
echo "Batch failed: {$error->getMessage()}\n";
});
```
##### Using with Swoole
Integrate with Swoole coroutines:
```php
use Swoole\Coroutine;
use function OpenFGA\writes;
Coroutine\run(function () use ($client, $storeId, $modelId, $tuplesToWrite) {
$result = Coroutine::create(function () use ($client, $storeId, $modelId, $tuplesToWrite) {
return writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxParallelRequests: 10
);
});
echo "Processed in coroutine: {$result->getTotalOperations()} tuples\n";
});
```
#### Performance optimization
##### Chunk size optimization
Find the optimal chunk size for your use case:
```php
use function OpenFGA\{tuple, tuples, writes};
// Generate test tuples
$testTuples = [];
for ($i = 0; $i < 1000; $i++) {
$testTuples[] = tuple("user:test_{$i}", 'member', 'org:acme');
}
$tuplesToWrite = tuples(...$testTuples);
// Test different chunk sizes
$chunkSizes = [10, 25, 50, 75, 100];
$results = [];
foreach ($chunkSizes as $chunkSize) {
$start = microtime(true);
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxTuplesPerChunk: $chunkSize,
maxParallelRequests: 5
);
$duration = microtime(true) - $start;
$throughput = count($testTuples) / $duration;
$results[$chunkSize] = [
'duration' => $duration,
'throughput' => $throughput,
'chunks' => $result->getTotalChunks(),
];
}
// Find optimal chunk size
$optimal = array_reduce(array_keys($results), function ($carry, $size) use ($results) {
return $results[$size]['throughput'] > $results[$carry]['throughput'] ? $size : $carry;
}, array_key_first($results));
echo "Optimal chunk size: {$optimal} (throughput: {$results[$optimal]['throughput']} tuples/sec)\n";
```
##### Memory management
Handle large datasets efficiently:
```php
use function OpenFGA\{tuple, tuples, writes};
// Process large datasets in chunks to manage memory
function processLargeTupleSet($client, $storeId, $modelId, $totalTuples) {
$batchSize = 10000; // Process 10k at a time
$processed = 0;
while ($processed < $totalTuples) {
// Generate batch (in real app, fetch from database)
$batchTuples = [];
$remaining = min($batchSize, $totalTuples - $processed);
for ($i = 0; $i < $remaining; $i++) {
$batchTuples[] = tuple(
"user:" . ($processed + $i),
'member',
'org:acme'
);
}
$tuplesToWrite = tuples(...$batchTuples);
// Process batch with high parallelism
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxParallelRequests: 10,
maxTuplesPerChunk: 100
);
$processed += $remaining;
echo "Processed: {$processed}/{$totalTuples}\n";
// Allow garbage collection between batches
unset($batchTuples, $tuplesToWrite, $result);
}
}
```
#### Monitoring and debugging
##### Performance metrics
Track performance metrics for optimization:
```php
use function OpenFGA\{tuple, tuples, writes};
// Note: This is an example helper class and not part of the SDK.
class BatchMetrics {
public static function track($client, $storeId, $modelId, $tuplesToWrite, $options) {
$start = microtime(true);
$startMemory = memory_get_usage(true);
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxParallelRequests: $options['parallelism'] ?? 1
);
$duration = microtime(true) - $start;
$memoryUsed = memory_get_usage(true) - $startMemory;
return [
'duration' => $duration,
'throughput' => count($tuplesToWrite) / $duration,
'memory_mb' => $memoryUsed / 1024 / 1024,
'chunks' => $result->getTotalChunks(),
'failures' => $result->getFailedChunks(),
'efficiency' => $result->getSuccessfulOperations() / count($tuplesToWrite),
];
}
}
// Use metrics to compare strategies
$metrics = BatchMetrics::track($client, $storeId, $modelId, $tuplesToWrite, ['parallelism' => 10]);
echo "Throughput: {$metrics['throughput']} tuples/sec\n";
echo "Memory usage: {$metrics['memory_mb']} MB\n";
echo "Efficiency: " . ($metrics['efficiency'] * 100) . "%\n";
```
##### Debug logging
Enable detailed logging for troubleshooting:
```php
use Psr\Log\LoggerInterface;
// Note: This is an example helper class and not part of the SDK.
class BatchLogger {
private LoggerInterface $logger;
public function logBatchOperation($result) {
$this->logger->info('Batch operation completed', [
'total_operations' => $result->getTotalOperations(),
'successful_chunks' => $result->getSuccessfulChunks(),
'failed_chunks' => $result->getFailedChunks(),
'duration' => $result->getDuration(),
]);
if ($result->hasErrors()) {
foreach ($result->getErrors() as $error) {
$this->logger->error('Chunk failed', [
'error' => $error->getMessage(),
'code' => $error->getCode(),
]);
}
}
}
}
```
#### Best practices
##### 1. Start conservative, scale up
Begin with lower parallelism and increase based on monitoring:
```php
use function OpenFGA\{tuple, tuples, writes};
// Development environment
$parallelism = 2;
// Staging environment
$parallelism = 5;
// Production (after load testing)
$parallelism = 10;
```
##### 2. Handle rate limits gracefully
Implement backoff when hitting rate limits:
```php
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite,
maxParallelRequests: 5,
maxRetries: 5, // More retries for rate limits
retryDelaySeconds: 2.0, // Longer initial delay
stopOnFirstError: false // Continue on error
);
```
##### 3. Monitor resource usage
Keep an eye on system resources:
```php
use function OpenFGA\{tuple, tuples, writes};
// Monitor CPU and memory during batch operations
$cpuBefore = sys_getloadavg()[0];
$memBefore = memory_get_usage(true);
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $writes,
deletes: $deletes,
maxParallelRequests: 10
);
$cpuAfter = sys_getloadavg()[0];
$memAfter = memory_get_usage(true);
echo "CPU load increase: " . ($cpuAfter - $cpuBefore) . "\n";
echo "Memory increase: " . (($memAfter - $memBefore) / 1024 / 1024) . " MB\n";
```
##### 4. Use appropriate chunk sizes
Balance between API limits and efficiency:
- **Small chunks (10-25)**: Lower latency per request, more overhead
- **Medium chunks (50)**: Good balance for most use cases
- **Large chunks (75-100)**: Maximum efficiency, higher latency per request
##### 5. Implement circuit breakers
Protect against cascading failures:
```php
use function OpenFGA\{tuple, tuples, writes};
// Note: This is an example helper class and not part of the SDK.
class BatchCircuitBreaker {
private int $failures = 0;
private int $threshold = 5;
private bool $open = false;
public function executeBatch($client, $storeId, $modelId, $tuplesToWrite) {
if ($this->open) {
throw new \RuntimeException('Circuit breaker is open');
}
try {
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: $tuplesToWrite
);
$this->failures = 0; // Reset on success
return $result;
} catch (\Exception $e) {
$this->failures++;
if ($this->failures >= $this->threshold) {
$this->open = true;
}
throw $e;
}
}
}
```
<!-- End of evansims/openfga-php/docs/Features/Concurrency.md -->
<!-- Source: evansims/openfga-php/docs/Features/Exceptions.md -->
This guide explains how to properly handle errors in the OpenFGA PHP SDK using our Result type system and enum-based exceptions.
#### Prerequisites
The examples in this guide assume you have the following imports and setup:
```php
<?php
declare(strict_types=1);
use OpenFGA\Client;
$client = new Client(
url: $_ENV['FGA_API_URL'] ?? 'http://localhost:8080',
);
$storeId = $_ENV['FGA_STORE_ID'];
$modelId = $_ENV['FGA_MODEL_ID'];
```
#### Overview
The OpenFGA PHP SDK uses a modern approach to error handling that emphasizes type safety, predictability, and internationalization support. Instead of throwing exceptions for expected error cases, we return `Result` types that explicitly model success and failure states.
##### Philosophy
Our error handling philosophy is built on three core principles:
1. **Explicit over implicit** - Errors are part of the return type, not hidden exceptions
2. **Type-safe over dynamic** - Use enums for error types, not string comparisons
3. **Composable over nested** - Chain operations with Result methods, not try/catch blocks
##### Why result types
Traditional exception handling has several drawbacks:
```php
// ❌ Errors are hidden
try {
$response = $client->check($user, $relation, $object);
// How do we know what errors this might throw?
} catch (Exception $e) {
// Generic catch loses type information
}
```
Our Result type makes errors explicit:
```php
// ✅ Errors are visible in the type signature
$result = $client->check(
user: 'user:anne',
relation: 'reader',
object: 'document:budget'
);
// The type system tells us this returns Result<CheckResponse, ClientThrowable>
```
#### Using the result type
The `Result` type represents a successful value or a failure, and provides a rich API for handling both cases elegantly.
```php
// All Client methods return Result types
$result = $client->check(
tupleKey: new TupleKey(user: 'user:anne', relation: 'reader', object: 'document:budget')
)
// Check if the operation succeeded
if ($result->succeeded()) {
$response = $result->unwrap();
echo "Access allowed: " . ($response->getAllowed() ? 'Yes' : 'No');
}
// Or check if it failed
if ($result->failed()) {
$error = $result->err();
echo "Operation failed: " . $error->getMessage();
}
```
##### Chaining operations
Result types support fluent chaining for elegant error handling:
```php
$result = $client->check(/* ... */)
->success(function ($response) {
// Optional side effect on success
logger()->info('Authorization check completed', [
'allowed' => $response->getAllowed()
]);
})
->failure(function ($error) {
// Optional side effect on failure
logger()->error('Authorization check failed', [
'error' => $error->getMessage()
]);
})
->then(function ($response) {
// Transform successful value
return $response->getAllowed() ? 'GRANTED' : 'DENIED';
})
->recover(function ($error) {
// Recover from specific errors
if ($error instanceof NetworkException) {
return 'UNKNOWN'; // Fail open on network errors
}
throw $error; // Re-throw other errors
});
// Get the final value
$accessStatus = $result->unwrap(); // 'GRANTED', 'DENIED', or 'UNKNOWN'
```
##### Unwrapping patterns
There are several ways to extract values from Results:
```php
// 1. Simple unwrap - throws on failure
$response = $result->unwrap();
// 2. Unwrap with default - never throws
$response = $result->unwrap(fn() => new CheckResponse(['allowed' => false]));
// 3. Pattern matching
$allowed = match(true) {
$result->succeeded() => $result->unwrap()->getAllowed(),
$result->failed() => false, // Default to denied on error
};
```
##### Error propagation
Use `rethrow()` to convert Result failures back to exceptions when needed:
```php
public function canUserRead(string $userId, string $documentId): bool
{
return $this->client->check(
tupleKey: new TupleKey(user: $userId, relation: 'reader', object: $documentId)
)
->rethrow() // Throws the underlying exception if failed
->unwrap()
->getAllowed();
}
```
#### Enum-based exception system
The SDK uses enum-backed exceptions for type-safe error handling. Each exception type extends from specific enum cases:
##### Exception hierarchy
```
ClientThrowable (interface)
├── ClientException
│ └── Backed by ClientError enum:
│ ├── Validation
│ ├── Configuration
│ ├── Authentication
│ ├── Network
│ └── Serialization
├── NetworkException
│ └── Backed by NetworkError enum:
│ ├── Timeout
│ ├── Conflict
│ ├── Forbidden
│ ├── Invalid
│ ├── Request
│ ├── Server
│ ├── Unauthenticated
│ ├── UndefinedEndpoint
│ └── Unexpected
├── AuthenticationException
│ └── Backed by AuthenticationError enum:
│ ├── TokenExpired
│ └── TokenInvalid
├── ConfigurationException
│ └── Backed by ConfigurationError enum:
│ ├── HttpClientMissing
│ ├── HttpRequestFactoryMissing
│ ├── HttpResponseFactoryMissing
│ └── HttpStreamFactoryMissing
└── SerializationException
└── Backed by SerializationError enum:
├── Response
├── MissingRequiredParam
├── InvalidItemType
├── UndefinedItemType
├── EmptyCollection
└── CouldNotAddItems
```
##### When to use each exception type
###### ClientException
General client-side errors that don't fit other categories:
```php
// Validation errors
throw ClientError::Validation->exception(context: [
'message' => 'Store ID cannot be empty'
]);
// Generic client errors
throw ClientError::Network->exception(context: [
'message' => 'Unable to connect to OpenFGA'
]);
```
###### NetworkException
HTTP and network-related errors:
```php
// From HTTP status codes
$error = match($statusCode) {
400 => NetworkError::Invalid,
401 => NetworkError::Unauthenticated,
403 => NetworkError::Forbidden,
404 => NetworkError::UndefinedEndpoint,
409 => NetworkError::Conflict,
422 => NetworkError::Timeout,
500 => NetworkError::Server,
default => NetworkError::Unexpected,
};
throw $error->exception(
request: $request,
response: $response
);
```
###### AuthenticationException
OAuth/token-related errors:
```php
// Token validation
if ($token->isExpired()) {
throw AuthenticationError::TokenExpired->exception();
}
if (!$token->isValid()) {
throw AuthenticationError::TokenInvalid->exception();
}
```
###### ConfigurationException
Setup and configuration errors:
```php
// Missing dependencies
if ($httpClient === null) {
throw ConfigurationError::HttpClientMissing->exception();
}
```
###### SerializationException
JSON encoding/decoding and data transformation errors:
```php
// Invalid response data
if (!is_array($data)) {
throw SerializationError::Response->exception(context: [
'message' => 'Expected array, got ' . gettype($data)
]);
}
```
#### Pattern matching with `match`
PHP 8.3's match expression provides elegant error handling:
##### Basic pattern matching
```php
$result = $client->check(/* ... */);
$accessLevel = match(true) {
$result->failed() => 'ERROR',
$result->unwrap()->getAllowed() => 'ALLOWED',
default => 'DENIED',
};
```
##### Matching on exception types
```php
$result->failure(function ($error) {
$response = match($error::class) {
NetworkException::class => handleNetworkError($error),
AuthenticationException::class => refreshTokenAndRetry(),
ClientException::class => logClientError($error),
default => throw $error,
};
});
```
##### Matching on error enums
```php
$result->failure(function ($error) {
if ($error instanceof NetworkException) {
$action = match($error->kind) {
NetworkError::Timeout => retry(),
NetworkError::Unauthenticated => authenticate(),
NetworkError::Forbidden => requestAccess(),
NetworkError::Server => notifyOps(),
default => logError($error),
};
}
});
```
##### Exhaustive matching
Use match for exhaustive error handling:
```php
public function translateError(ClientException $error): string
{
return match($error->kind) {
ClientError::Validation => 'Invalid input provided',
ClientError::Configuration => 'SDK is not properly configured',
ClientError::Authentication => 'Authentication failed',
ClientError::Network => 'Network error occurred',
ClientError::Serialization => 'Data format error',
// No default - ensures all cases are handled
};
}
```
##### Benefits over if/else
```php
// ❌ Verbose if/else chains
if ($error instanceof NetworkException) {
if ($error->kind === NetworkError::Timeout) {
return retry();
} elseif ($error->kind === NetworkError::Unauthenticated) {
return authenticate();
} else {
return logError($error);
}
}
// ✅ Concise match expression
return match([$error::class, $error->kind ?? null]) {
[NetworkException::class, NetworkError::Timeout] => retry(),
[NetworkException::class, NetworkError::Unauthenticated] => authenticate(),
[NetworkException::class, $_] => logError($error),
default => throw $error,
};
```
#### Anti-patterns to avoid
##### ❌ String comparison
Never compare error messages as strings:
```php
// ❌ BAD - Breaks with i18n, brittle
try {
$client->check(/* ... */);
} catch (Exception $e) {
if ($e->getMessage() === 'Store not found') {
// This breaks when messages are translated!
}
}
// ✅ GOOD - Type-safe enum comparison
$result = $client->check(/* ... */);
$result->failure(function ($error) {
if ($error instanceof NetworkException &&
$error->kind === NetworkError::UndefinedEndpoint) {
// Handle store not found
}
});
```
##### ❌ Catching generic exception
Avoid catching overly broad exception types:
```php
// ❌ BAD - Catches everything, loses type information
try {
$response = $client->check(/* ... */)->unwrap();
} catch (Exception $e) {
logger()->error('Something went wrong');
}
// ✅ GOOD - Handle specific error types
$client->check(/* ... */)
->failure(function ($error) {
match($error::class) {
NetworkException::class => logger()->error('Network error', ['kind' => $error->kind]),
AuthenticationException::class => logger()->error('Auth error'),
default => logger()->error('Unexpected error', ['type' => $error::class]),
};
});
```
##### ❌ Ignoring result types
Never ignore the Result wrapper:
```php
// ❌ BAD - Ignores potential failures
$response = $client->check(/* ... */)->unwrap(); // Throws on failure!
// ✅ GOOD - Handle both success and failure
$result = $client->check(/* ... */);
if ($result->succeeded()) {
$response = $result->unwrap();
// Use response
} else {
// Handle error appropriately
}
```
##### ❌ String-based error handling
Avoid string-based error detection due to i18n:
```php
// ❌ BAD - Breaks with different locales
if (str_contains($error->getMessage(), 'expired')) {
// Assumes English error messages!
}
// ✅ GOOD - Use enum-based detection
if ($error instanceof AuthenticationException &&
$error->kind === AuthenticationError::TokenExpired) {
// Works regardless of locale
}
```
#### Internationalization (i18n) support
The OpenFGA PHP SDK fully supports internationalization of error messages. This means your application can display error messages in multiple languages without changing your error handling logic.
##### How i18n works
1. Error messages are defined in YAML translation files (`translations/messages.{locale}.yaml`)
2. Exceptions use translation keys instead of hardcoded messages
3. The Client's language setting determines which translations are used
4. Error enum cases remain the same regardless of language
##### Setting the language
```php
use OpenFGA\Language;
// Create a client with Spanish error messages
$client = new Client(
url: 'https://api.openfga.example',
language: Language::Spanish
);
// Or set the language later
$client->setLanguage(Language::French); // Switch to French
```
##### Example: Same error in multiple languages
This shows how the same error appears differently based on language context:
```php
use OpenFGA\Language;
// Create clients with different languages
$englishClient = new Client(url: 'https://api.openfga.example', language: Language::English);
$spanishClient = new Client(url: 'https://api.openfga.example', language: Language::Spanish);
try {
// Try an invalid operation with English client
$englishClient->check(
tupleKey: tuple('', 'viewer', 'document:report')
)->unwrap();
} catch (Throwable $e) {
echo $e->getMessage(); // "User identifier cannot be empty"
}
try {
// Same invalid operation with Spanish client
$spanishClient->check(
tupleKey: tuple('', 'viewer', 'document:report')
)->unwrap();
} catch (Throwable $e) {
echo $e->getMessage(); // "El identificador del usuario no puede estar vacío"
}
```
##### Type-safe error handling with i18n
The enum-based approach ensures that error handling remains consistent regardless of language:
```php
$result = $client->check(/* ... */);
$result->failure(function ($error) {
if ($error instanceof ClientException) {
// Works the same way regardless of language setting
match($error->getError()) {
ClientError::InvalidConfiguration => notifyAdmin(),
ClientError::Authentication => redirectToLogin(),
ClientError::Network => retryOperation(),
default => logUnexpectedError($error)
};
}
});
```
#### Code examples
##### Complete error handling flow
Here's a real-world example showing proper error handling:
```php
// Note: The AccessResult class used within AuthorizationService is an example
// value object for illustration and not part of the SDK.
class AuthorizationService
{
private Client $client;
public function checkAccess(string $userId, string $resource): AccessResult
{
return $this->client->check(
tupleKey: new TupleKey($userId, 'reader', $resource)
)
->then(function ($response) {
// Transform successful response
return new AccessResult(
allowed: $response->getAllowed(),
reason: $response->getAllowed() ? 'GRANTED' : 'DENIED'
);
})
->recover(function ($error) {
// Handle specific errors gracefully
return match([$error::class, $error->kind ?? null]) {
// Network timeouts - fail open
[NetworkException::class, NetworkError::Timeout] =>
new AccessResult(true, 'TIMEOUT_FAIL_OPEN'),
// Authentication errors - deny access
[AuthenticationException::class, $_] =>
new AccessResult(false, 'AUTH_ERROR'),
// Server errors - check cache
[NetworkException::class, NetworkError::Server] =>
$this->checkCachedAccess() ?? new AccessResult(false, 'SERVER_ERROR'),
// Everything else - deny by default
default => new AccessResult(false, 'UNKNOWN_ERROR'),
};
})
->success(function ($result) {
// Log successful checks
$this->logger->info('Access check completed', [
'allowed' => $result->allowed,
'reason' => $result->reason,
]);
})
->failure(function ($error) {
// Log errors with context
$this->logger->error('Access check failed', [
'error_type' => $error::class,
'error_kind' => $error->kind ?? null,
'message' => $error->getMessage(),
]);
})
->unwrap();
}
public function grantAccess(string $userId, string $resource): void
{
$this->client->writeTuples(
writes: new TupleKeys(
new TupleKey($userId, 'reader', $resource)
)
)
->failure(function ($error) use ($userId, $resource) {
// Log with translated message
$this->logger->error(
Translator::trans(Messages::CLIENT_ERROR_NETWORK),
[
'user' => $userId,
'resource' => $resource,
'error' => $error::class,
]
);
})
->rethrow(); // Convert to exception if failed
}
}
```
##### Testing error conditions
```php
// Note: The following example assumes a testing environment like Pest or PHPUnit,
// using assertions like expect() and extending a base TestCase.
// The AuthorizationService class being tested is also an example helper class.
class AuthorizationServiceTest extends TestCase
{
public function testHandlesNetworkTimeout(): void
{
$client = $this->createMock(Client::class);
$client->method('check')
->willReturn(new Failure(
new NetworkException(
kind: NetworkError::Timeout,
request: $this->createMock(RequestInterface::class)
)
));
$service = new AuthorizationService($client);
$result = $service->checkAccess('user:anne', 'document:budget');
// Should fail open on timeout
expect($result->allowed)->toBeTrue();
expect($result->reason)->toBe('TIMEOUT_FAIL_OPEN');
}
public function testHandlesValidationErrors(): void
{
$client = $this->createMock(Client::class);
$client->method('check')
->willReturn(new Failure(
ClientError::Validation->exception(context: [
'message' => 'Invalid user format'
])
));
$service = new AuthorizationService($client);
$result = $service->checkAccess('invalid-user', 'document:budget');
// Should deny on validation errors
expect($result->allowed)->toBeFalse();
expect($result->reason)->toBe('UNKNOWN_ERROR');
}
}
```
#### Best practices summary
1. **Always handle Result types** - Never call `unwrap()` without checking success first
2. **Use enum comparisons** - Compare error types and kinds, not message strings
3. **Leverage match expressions** - Use PHP 8.3+ match for clean error handling
4. **Log with context** - Include error type, kind, and relevant data
5. **Fail safely** - Define sensible defaults for error cases
6. **Test error paths** - Write tests for failure scenarios
7. **Use type hints** - Let the type system help catch errors at compile time
Remember: The goal is to make errors impossible to ignore, easy to handle, and consistent across locales.
<!-- End of evansims/openfga-php/docs/Features/Exceptions.md -->
<!-- Source: evansims/openfga-php/docs/Features/Helpers.md -->
The OpenFGA PHP SDK provides a collection of helper functions that dramatically simplify common authorization operations. These helpers reduce boilerplate code and make your authorization logic more readable and maintainable.
#### Prerequisites
All examples in this guide assume the following setup:
```php
<?php
declare(strict_types=1);
use OpenFGA\Client;
$client = new Client(
url: $_ENV['FGA_API_URL'] ?? 'http://localhost:8080',
);
```
#### Context helper
The `context()` helper sets ambient values that other helpers can use implicitly, eliminating the need to pass client, store, and model parameters to every function call. This is especially powerful when combined with other helpers.
##### Basic usage
```php
use function OpenFGA\{context, allowed, write, tuple};
$result = context(function() {
// All helpers within this context can omit client/store/model parameters
$canView = allowed(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget'
);
if (!$canView) {
write(tuple('user:anne', 'viewer', 'document:budget'));
}
return $canView;
}, client: $client, store: $storeId, model: $modelId);
```
##### Nested contexts with inheritance
Child contexts automatically inherit values from their parent context unless explicitly overridden:
```php
use function OpenFGA\{context, users, filter};
context(function() {
// Uses outer context's client and store
$viewers = users('document:public', 'viewer', filter('user'));
context(function() {
// Inherits client/store from parent, but uses different model
$editors = users('document:private', 'editor', filter('user'));
}, model: $privateModelId);
}, client: $client, store: $storeId, model: $publicModelId);
```
##### Partial context overrides
```php
use function OpenFGA\{context, allowed, tuple};
context(function() {
// Set base client and store for user operations
context(function() {
// Override just the store for admin operations
$isAdmin = allowed(tuple: tuple('user:anne', 'admin', 'system:settings'));
}, store: $adminStoreId);
}, client: $client, store: $userStoreId, model: $modelId);
```
#### Model helpers
##### Creating tuples
The `tuple()` helper simplifies creating relationship tuples:
```php
use function OpenFGA\tuple;
$tuple = tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
);
```
With conditions:
```php
use OpenFGA\Models\Condition;
use function OpenFGA\tuple;
$tuple = tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
condition: new Condition(name: 'in_office_hours', expression: /* ... */),
);
```
##### Creating tuple collections
The `tuples()` helper creates collections for batch operations:
```php
use function OpenFGA\{tuple, tuples};
$tupleCollection = tuples(
tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
tuple(
user: 'user:bob',
relation: 'editor',
object: 'document:budget',
),
tuple(
user: 'user:charlie',
relation: 'owner',
object: 'document:budget',
),
);
```
##### Creating batch check items
The `check()` helper creates BatchCheckItem instances for batch authorization checks:
```php
use function OpenFGA\{check, tuple};
$checkItem = check(
tuple: tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
// correlation: 'anne-budget-check', // Optional
);
```
If no correlation ID is provided, one is automatically generated based on the tuple key.
##### Creating stores
The `store()` helper creates a store and returns its ID directly:
```php
use function OpenFGA\store;
$storeId = store(
name: 'my-application-store',
client: $client,
);
```
##### Creating authorization models from DSL
The `dsl()` helper transforms DSL strings into authorization models:
```yaml
model
schema 1.1
type user
type document
relations
define viewer: [user]
define editor: [user]
define owner: [user]
```
```php
use function OpenFGA\dsl;
$model = dsl(
dsl: file_get_contents('path/to/dsl.fga')
client: $client,
);
```
##### Creating models in a store
The `model()` helper creates an authorization model and returns its ID:
```php
use function OpenFGA\model;
$modelId = model(
model: $model,
client: $client,
store: $storeId,
);
```
#### Request helpers
##### Granting permissions
The `grant()` helper provides an intuitive way to grant permissions. It's functionally equivalent to `write()` but uses clearer terminology for permission management:
```php
use function OpenFGA\{tuple, grant};
// Grant a single permission
grant(
client: $client,
store: $storeId,
model: $modelId,
tuples: tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
);
// Grant multiple permissions at once
use function OpenFGA\{tuples};
grant(
client: $client,
store: $storeId,
model: $modelId,
tuples: tuples(
tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
tuple(
user: 'user:anne',
relation: 'editor',
object: 'document:forecast',
),
),
);
// Grant permissions based on business logic
if ($user->hasSubscription()) {
grant(tuple($user->getId(), 'premium_user', 'feature:advanced_analytics'));
}
```
##### Writing tuples
The `write()` helper provides the simplest way to write a tuple:
```php
use function OpenFGA\{tuple, write};
write(
client: $client,
store: $storeId,
model: $modelId,
tuples: tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
);
```
The helper also supports writing multiple tuples at once:
```php
use function OpenFGA\{tuple, tuples, write};
write(
client: $client,
store: $storeId,
model: $modelId,
tuples: tuples(
tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
tuple(
user: 'user:bob',
relation: 'editor',
object: 'document:forecast',
),
),
);
```
##### Revoking permissions
The `revoke()` helper provides an intuitive way to revoke permissions. It's functionally equivalent to `delete()` but uses clearer terminology for permission management:
```php
use function OpenFGA\{tuple, revoke};
// Revoke a single permission
revoke(
client: $client,
store: $storeId,
model: $modelId,
tuples: tuple(
user: 'user:anne',
relation: 'editor',
object: 'document:budget',
),
);
// Revoke multiple permissions at once
use function OpenFGA\{tuples};
revoke(
client: $client,
store: $storeId,
model: $modelId,
tuples: tuples(
tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
tuple(
user: 'user:anne',
relation: 'editor',
object: 'document:forecast',
),
),
);
// Revoke permissions based on business logic
if ($user->subscriptionExpired()) {
revoke(tuple($user->getId(), 'premium_user', 'feature:advanced_analytics'));
}
```
##### Deleting tuples
The `delete()` helper simplifies tuple deletion:
```php
use function OpenFGA\{tuple, delete};
delete(
client: $client,
store: $storeId,
model: $modelId,
tuples: tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
);
```
##### Checking permissions
The `allowed()` helper returns a boolean directly with guaranteed error-safe behavior. It will return true only when explicitly allowed, and false when denied or any error occurs.
```php
use function OpenFGA\{tuple, allowed};
if (allowed(
client: $client,
store: $storeId,
model: $modelId,
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
)) {
// User has access
}
```
The helper supports a number of options:
```php
use OpenFGA\Models\Enums\Consistency;
use function OpenFGA\{tuple, allowed};
if (allowed(
client: $client,
store: $storeId,
model: $modelId,
tuple: tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:budget',
),
context: (object)['time' => '2024-01-15T10:00:00Z'],
contextualTuples: tuples(
tuple(
user: 'user:anne',
relation: 'member',
object: 'team:engineering',
)
),
consistency: Consistency::HIGHER_CONSISTENCY
)) {
// User has access
}
```
##### Finding accessible objects
The `objects()` helper simplifies finding all objects a user has access to with guaranteed error-safe behavior. It returns an empty array on any error.
```php
use function OpenFGA\objects;
$documents = objects(
type: 'document',
relation: 'viewer',
user: 'user:anne',
client: $client,
store: $storeId,
model: $modelId,
);
// Returns array of accessible documents or [] on any error
```
The helper supports a number of options:
```php
use function OpenFGA\{objects, tuple, tuples};
$documents = objects(
type: 'document',
relation: 'viewer',
user: 'user:anne',
client: $client,
store: $storeId,
model: $modelId,
context: (object)['department' => 'engineering'],
contextualTuples: tuples(
tuple(
user: 'user:anne',
relation: 'member',
object: 'team:engineering',
)
),
consistency: Consistency::HIGHER_CONSISTENCY
);
```
##### Listing authorization models
The `models()` helper simplifies retrieving authorization models with automatic pagination:
```php
use function OpenFGA\models;
$models = models(
client: $client,
store: $storeId,
);
foreach ($models as $model) {
echo "Model: {$model->getId()}\n";
}
```
##### Batch write operations
The `writes()` helper handles large tuple operations with automatic chunking:
```php
use function OpenFGA\{tuple, tuples, writes};
$result = writes(
client: $client,
store: $storeId,
model: $modelId,
writes: tuples(
tuple(
user: 'user:anne',
relation: 'viewer',
object: 'document:1',
),
tuple(
user: 'user:bob',
relation: 'viewer',
object: 'document:2',
),
// ...
),
maxParallelRequests: 10,
maxTuplesPerChunk: 100,
maxRetries: 3,
stopOnFirstError: false
);
echo "Success rate: " . ($result->getSuccessRate() * 100) . "%\n";
```
##### Batch authorization checks
The `checks()` helper simplifies performing multiple authorization checks in a single request:
```php
use function OpenFGA\{checks, check};
$results = checks(
client: $client,
store: $storeId,
model: $modelId,
check(user: 'user:anne', relation: 'viewer', object: 'document:budget'),
check(user: 'user:bob', relation: 'editor', object: 'document:budget'),
check(user: 'user:charlie', relation: 'owner', object: 'document:budget')
);
foreach ($results as $correlationId => $allowed) {
echo "$correlationId: " . ($allowed ? 'allowed' : 'denied') . "\n";
}
```
#### Result helpers
##### Creating results
```php
use function OpenFGA\{ok, err};
// Create a Success
$success = ok('Operation completed');
// Create a Failure
$failure = err(new Exception('Operation failed'));
```
##### Working with results
The `result()` helper provides unified handling:
```php
use function OpenFGA\result;
// Execute a closure safely
$result = result(function () {
// Some operation that might throw
return performRiskyOperation();
});
// Unwrap a Result
$value = result($someResult);
```
##### Handling success and failure
**Helper usage:**
```php
use function OpenFGA\{success, failure, unwrap};
// Handle success
success($result, function ($value) {
echo "Success: $value\n";
});
// Handle failure
failure($result, function ($error) {
echo "Error: " . $error->getMessage() . "\n";
});
// Unwrap with fallback
$value = unwrap($result, fn() => 'default value');
```
#### Reading tuples
The `read()` helper provides a simplified way to read tuples with automatic pagination:
```php
use function OpenFGA\{read, tuple};
// Read all tuples in a store
$allTuples = read(
client: $client,
store: $storeId
);
// Read tuples filtered by user
$userTuples = read(
client: $client,
store: $storeId,
tuple: tuple('user:anne', '', '') // Empty relation and object act as wildcards
);
// Read with custom page size and consistency
use OpenFGA\Models\Enums\Consistency;
$tuples = read(
client: $client,
store: $storeId,
pageSize: 100,
consistency: Consistency::HigherConsistency
);
// Using with context
context(function() {
$allTuples = read(); // Uses ambient client/store from context
foreach ($allTuples as $tuple) {
echo "{$tuple->getUser()} {$tuple->getRelation()} {$tuple->getObject()}\n";
}
}, client: $client, store: $storeId);
```
#### Listing tuple changes
The `changes()` helper retrieves all tuple changes with automatic pagination:
```php
use function OpenFGA\changes;
// Get all changes in a store
$allChanges = changes(
client: $client,
store: $storeId
);
foreach ($allChanges as $change) {
echo "Change: {$change->getOperation()->value} at {$change->getTimestamp()->format('Y-m-d H:i:s')}\n";
}
// Filter changes by object type
$documentChanges = changes(
client: $client,
store: $storeId,
type: 'document'
);
// Get recent changes since yesterday
$recentChanges = changes(
client: $client,
store: $storeId,
startTime: new DateTimeImmutable('-1 day')
);
// Using with context and custom page size
context(function() {
$changes = changes(pageSize: 100);
echo "Total changes: " . count($changes) . "\n";
}, client: $client, store: $storeId);
```
#### Finding users with access
The `users()` helper lists all users who have a specific relationship with an object:
```php
use function OpenFGA\{users, filter, filters};
// Find all users who can view a document
$viewers = users(
object: 'document:budget',
relation: 'viewer',
filters: filter('user'),
client: $client,
store: $storeId,
model: $modelId
);
// Returns: ['user:anne', 'user:bob', 'user:charlie']
// Find both users and groups with edit access
$editors = users(
object: 'document:budget',
relation: 'editor',
filters: filters(
filter('user'),
filter('group')
),
client: $client,
store: $storeId,
model: $modelId
);
// Returns: ['user:anne', 'group:engineering', 'user:david']
// Filter by relation type
$teamMembers = users(
object: 'document:technical-spec',
relation: 'editor',
filters: filter('team', 'member'), // Only team members
client: $client,
store: $storeId,
model: $modelId
);
// Using with context and contextual tuples
context(function() {
use function OpenFGA\{tuple, tuples};
$editors = users(
object: 'document:technical-spec',
relation: 'editor',
filters: filter('user'),
contextualTuples: tuples(
tuple('user:anne', 'member', 'team:engineering')
)
);
}, client: $client, store: $storeId, model: $modelId);
```
#### User type filters
The `filter()` and `filters()` helpers create user type filters for queries:
```php
use function OpenFGA\{filter, filters};
// Single user type filter
$userFilter = filter('user');
// Filter with relation
$groupMemberFilter = filter('group', 'member');
// Multiple filters collection
$mixedFilters = filters(
filter('user'),
filter('group'),
filter('service_account'),
filter('team', 'member')
);
```
#### Language helpers
The `lang()` and `trans()` helpers simplify working with internationalization:
```php
use OpenFGA\Language;
use OpenFGA\Messages;
use function OpenFGA\{lang, trans};
// Get language enum by locale
$german = lang('de'); // Returns Language::German
$portuguese = lang('pt_BR'); // Returns Language::PortugueseBrazilian
$default = lang(); // Returns Language::English (default)
// Translate messages
$message = trans(Messages::NO_LAST_REQUEST_FOUND);
// Translate with parameters
$error = trans(
Messages::NETWORK_ERROR,
['message' => 'Connection timeout']
);
// Translate with specific language
$germanError = trans(
Messages::AUTH_USER_MESSAGE_TOKEN_EXPIRED,
[],
Language::German
);
// Using in client configuration
$client = new Client(
url: $url,
language: lang('de')
);
```
#### Next steps
- Explore the Tuples Guide for more details on relationship tuples
- Learn about Batch Operations for handling large datasets
- Understand Result Patterns for robust error handling
- See Integration Examples for real-world usage patterns
<!-- End of evansims/openfga-php/docs/Features/Helpers.md -->
<!-- Source: evansims/openfga-php/docs/Features/Integration.md -->
Ready to integrate OpenFGA into your existing application? This guide shows you how to add authorization to popular PHP frameworks and patterns.
#### Prerequisites
Before integrating with your framework, you'll need these common OpenFGA imports and setup patterns used throughout the examples:
```php
use OpenFGA\{Client, ClientInterface};
use OpenFGA\Authentication\ClientCredentialAuthentication;
use function OpenFGA\{tuple, tuples, allowed, write, delete};
$client = new Client(
url: $_ENV['FGA_API_URL'],
authentication: new ClientCredentialAuthentication(
clientId: $_ENV['FGA_CLIENT_ID'],
clientSecret: $_ENV['FGA_CLIENT_SECRET'],
issuer: $_ENV['FGA_ISSUER'],
audience: $_ENV['FGA_AUDIENCE'],
),
);
$storeId = $_ENV['FGA_STORE_ID'];
$modelId = $_ENV['FGA_MODEL_ID'];
```
**Environment Variables:**
All examples assume these environment variables are configured:
- `FGA_API_URL` - Your OpenFGA server URL
- `FGA_CLIENT_ID` - Client credentials ID
- `FGA_CLIENT_SECRET` - Client credentials secret
- `FGA_ISSUER` - Token issuer URL
- `FGA_AUDIENCE` - Token audience
- `FGA_STORE_ID` - Your store identifier
- `FGA_MODEL_ID` - Your authorization model ID
#### Laravel Integration
##### Service Provider Setup
Create a service provider to configure OpenFGA:
```php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class OpenFgaServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton(ClientInterface::class, function () {
return new Client(
url: config('openfga.url'),
authentication: new ClientCredentialAuthentication(
clientId: config('openfga.client_id'),
clientSecret: config('openfga.client_secret'),
issuer: config('openfga.issuer'),
audience: config('openfga.audience'),
),
);
});
}
}
```
Add to your `config/openfga.php`:
```php
return [
'url' => env('FGA_API_URL', 'http://localhost:8080'),
'store_id' => env('FGA_STORE_ID'),
'model_id' => env('FGA_MODEL_ID'),
'client_id' => env('FGA_CLIENT_ID'),
'client_secret' => env('FGA_CLIENT_SECRET'),
'issuer' => env('FGA_ISSUER'),
'audience' => env('FGA_AUDIENCE'),
];
```
##### Permission Middleware
Create middleware for route-level authorization:
```php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\{JsonResponse, Request, Response};
class CheckPermission
{
private array $routeToResourceMap;
public function __construct(private ClientInterface $client, array $routeToResourceMap = [])
{
$this->routeToResourceMap = $routeToResourceMap ?: [
'documents.*' => 'document',
'users.*' => 'user',
'projects.*' => 'project',
'teams.*' => 'team',
// Add more mappings as needed
];
}
public function handle(Request $request, Closure $next, string $relation, ?string $resourceParam = null): Response|JsonResponse
{
$user = $request->user();
if (!$user) {
return response()->json(['error' => 'Unauthenticated'], 401);
}
// Extract resource from route parameter or use a default pattern
$resource = $resourceParam
? $request->route($resourceParam)
: $this->extractResourceFromRoute($request);
$canAccess = allowed(
client: $this->client,
store: config('openfga.store_id'),
model: config('openfga.model_id'),
tuple: tuple("user:{$user->id}", $relation, $resource)
);
if (!$canAccess) {
return response()->json(['error' => 'Forbidden'], 403);
}
return $next($request);
}
protected function extractResourceFromRoute(Request $request): string
{
$routeName = $request->route()->getName();
$resourceType = $this->resolveResourceType($routeName, $request);
$resourceId = $request->route('id') ?? $request->route('uuid') ?? $request->route('document') ?? $request->route('project');
return "{$resourceType}:{$resourceId}";
}
protected function resolveResourceType(string $routeName, Request $request): string
{
// Check if route name matches any configured patterns
foreach ($this->routeToResourceMap as $pattern => $resourceType) {
if (fnmatch($pattern, $routeName)) {
return $resourceType;
}
}
// Fallback: extract resource type from route name
// For routes like 'documents.show', 'users.edit', etc.
$parts = explode('.', $routeName);
if (count($parts) >= 2) {
return rtrim($parts[0], 's'); // Remove trailing 's' for plurals
}
// Last resort: use the first segment of the URL path
$pathSegments = explode('/', trim($request->path(), '/'));
return rtrim($pathSegments[0] ?? 'resource', 's');
}
}
```
Use in your routes:
```php
// routes/web.php
Route::middleware(['auth', 'permission:editor,document'])->group(function () {
Route::put('/documents/{document}', [DocumentController::class, 'update']);
Route::delete('/documents/{document}', [DocumentController::class, 'destroy']);
});
Route::middleware(['auth', 'permission:viewer,document'])->group(function () {
Route::get('/documents/{document}', [DocumentController::class, 'show']);
});
```
##### Eloquent Model Integration
Add authorization helpers to your models:
```php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Document extends Model
{
public function userCan(User $user, string $relation): bool
{
$client = app(ClientInterface::class);
return allowed(
client: $client,
store: config('openfga.store_id'),
model: config('openfga.model_id'),
tuple: tuple("user:{$user->id}", $relation, "document:{$this->id}")
);
}
public function scopeAccessibleBy($query, User $user, string $relation)
{
$client = app(ClientInterface::class);
$accessibleIds = $client->listObjects(
store: config('openfga.store_id'),
model: config('openfga.model_id'),
user: "user:{$user->id}",
relation: $relation,
type: 'document'
)->unwrap()->getObjects();
return $query->whereIn('id', $accessibleIds);
}
}
```
Usage in controllers:
```php
namespace App\Http\Controllers;
use App\Models\Document;
use Illuminate\Http\Request;
class DocumentController extends Controller
{
public function index(Request $request)
{
// Only show documents the user can view
$documents = Document::accessibleBy($request->user(), 'viewer')->get();
return view('documents.index', compact('documents'));
}
public function show(Document $document, Request $request)
{
// Middleware already checked permission, but you could double-check here
if (!$document->userCan($request->user(), 'viewer')) {
abort(403);
}
return view('documents.show', compact('document'));
}
}
```
#### Symfony Integration
##### Service Configuration
Configure OpenFGA as a service in `config/services.yaml`:
```yaml
# config/services.yaml
services:
OpenFGA\ClientInterface:
class: OpenFGA\Client
arguments:
$url: "%env(FGA_API_URL)%"
$authentication: "@openfga.authentication"
openfga.authentication:
class: OpenFGA\Authentication\ClientCredentialAuthentication
arguments:
$clientId: "%env(FGA_CLIENT_ID)%"
$clientSecret: "%env(FGA_CLIENT_SECRET)%"
$issuer: "%env(FGA_ISSUER)%"
$audience: "%env(FGA_AUDIENCE)%"
parameters:
openfga.store_id: "%env(FGA_STORE_ID)%"
openfga.model_id: "%env(FGA_MODEL_ID)%"
```
##### Voter Implementation
Create a custom voter for authorization decisions:
```php
namespace App\Security\Voter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\User\UserInterface;
class OpenFgaVoter extends Voter
{
public function __construct(
private ClientInterface $client,
private string $storeId,
private string $modelId,
) {}
protected function supports(string $attribute, mixed $subject): bool
{
// Support any attribute that follows the pattern "openfga.{relation}"
return str_starts_with($attribute, 'openfga.');
}
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
{
$user = $token->getUser();
if (!$user instanceof UserInterface) {
return false;
}
// Extract relation from attribute (for example "openfga.edit" -> "edit")
$relation = substr($attribute, 7);
// Build resource identifier from subject
$resource = $this->buildResourceIdentifier($subject);
return allowed(
client: $this->client,
store: $this->storeId,
model: $this->modelId,
tuple: tuple("user:{$user->getUserIdentifier()}", $relation, $resource)
);
}
private function buildResourceIdentifier(mixed $subject): string
{
if (is_string($subject)) {
return $subject;
}
if (is_object($subject) && method_exists($subject, 'getId')) {
$type = strtolower((new \ReflectionClass($subject))->getShortName());
return "{$type}:{$subject->getId()}";
}
throw new \InvalidArgumentException('Cannot build resource identifier from subject');
}
}
```
Use in your controllers:
```php
namespace App\Controller;
use App\Entity\Document;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DocumentController extends AbstractController
{
#[Route('/documents/{id}', methods: ['GET'])]
public function show(Document $document): Response
{
$this->denyAccessUnlessGranted('openfga.viewer', $document);
return $this->render('document/show.html.twig', [
'document' => $document,
]);
}
#[Route('/documents/{id}/edit', methods: ['GET', 'POST'])]
public function edit(Document $document): Response
{
$this->denyAccessUnlessGranted('openfga.editor', $document);
// Edit logic here
return $this->render('document/edit.html.twig', [
'document' => $document,
]);
}
}
```
#### Generic PHP Integration
##### Simple Authorization Service
For frameworks without built-in DI, create a simple service:
```php
namespace App\Services;
class AuthorizationService
{
private ClientInterface $client;
private string $storeId;
private string $modelId;
public function __construct(array $config)
{
$this->client = new Client(
url: $config['url'],
authentication: new ClientCredentialAuthentication(
clientId: $config['client_id'],
clientSecret: $config['client_secret'],
issuer: $config['issuer'],
audience: $config['audience'],
),
);
$this->storeId = $config['store_id'];
$this->modelId = $config['model_id'];
}
public function can(string $userId, string $relation, string $resource): bool
{
return allowed(
client: $this->client,
store: $this->storeId,
model: $this->modelId,
tuple: tuple("user:{$userId}", $relation, $resource)
);
}
public function grant(string $userId, string $relation, string $resource): void
{
write(
client: $this->client,
store: $this->storeId,
model: $this->modelId,
tuples: tuples(tuple("user:{$userId}", $relation, $resource))
);
}
public function revoke(string $userId, string $relation, string $resource): void
{
delete(
client: $this->client,
store: $this->storeId,
model: $this->modelId,
tuples: tuples(tuple("user:{$userId}", $relation, $resource))
);
}
public function listUserResources(string $userId, string $relation, string $type): array
{
return $this->client->listObjects(
store: $this->storeId,
model: $this->modelId,
user: "user:{$userId}",
relation: $relation,
type: $type
)->unwrap()->getObjects();
}
}
```
Usage:
```php
// Bootstrap
$config = [
'url' => $_ENV['FGA_API_URL'],
'store_id' => $_ENV['FGA_STORE_ID'],
'model_id' => $_ENV['FGA_MODEL_ID'],
'client_id' => $_ENV['FGA_CLIENT_ID'],
'client_secret' => $_ENV['FGA_CLIENT_SECRET'],
'issuer' => $_ENV['FGA_ISSUER'],
'audience' => $_ENV['FGA_AUDIENCE'],
];
$auth = new AuthorizationService($config);
// Check permissions
if (!$auth->can($currentUserId, 'editor', 'document:readme')) {
http_response_code(403);
echo json_encode(['error' => 'Forbidden']);
exit;
}
// Grant permission
$auth->grant($newUserId, 'viewer', 'document:readme');
// List accessible documents
$editableDocuments = $auth->listUserResources($currentUserId, 'editor', 'document');
```
#### Common Integration Patterns
##### Caching Layer
Add caching to improve performance:
```php
use Psr\SimpleCache\CacheInterface;
class CachedAuthorizationService
{
public function __construct(
private AuthorizationService $auth,
private CacheInterface $cache,
private int $ttl = 300 // 5 minutes
) {}
public function can(string $userId, string $relation, string $resource): bool
{
$cacheKey = "auth:{$userId}:{$relation}:{$resource}";
$cached = $this->cache->get($cacheKey);
if ($cached !== null) {
return $cached;
}
$result = $this->auth->can($userId, $relation, $resource);
// Cache the result and maintain the user index
$this->cache->set($cacheKey, $result, $this->ttl);
$this->addToUserCacheIndex($userId, $cacheKey);
return $result;
}
public function grant(string $userId, string $relation, string $resource): void
{
$this->auth->grant($userId, $relation, $resource);
// Invalidate related cache entries
$this->invalidateUserCache($userId);
}
private function invalidateUserCache(string $userId): void
{
$userIndexKey = "auth:index:{$userId}";
$userCacheKeys = $this->cache->get($userIndexKey, []);
if (!empty($userCacheKeys)) {
// Delete all cached permissions for this user
$this->cache->deleteMultiple($userCacheKeys);
// Clear the index
$this->cache->delete($userIndexKey);
}
}
private function addToUserCacheIndex(string $userId, string $cacheKey): void
{
$userIndexKey = "auth:index:{$userId}";
$userCacheKeys = $this->cache->get($userIndexKey, []);
if (!in_array($cacheKey, $userCacheKeys)) {
$userCacheKeys[] = $cacheKey;
$this->cache->set($userIndexKey, $userCacheKeys, 86400); // 24 hours
}
}
}
```
##### Middleware Factory
Create reusable middleware for different frameworks:
```php
class AuthorizationMiddlewareFactory
{
public static function createLaravelMiddleware(AuthorizationService $auth): \Closure
{
return function ($request, $next, $relation, $resourceParam = 'id') use ($auth) {
$user = $request->user();
$resourceId = $request->route($resourceParam);
$resourceType = $request->route()->getActionName();
if (!$auth->can($user->id, $relation, "{$resourceType}:{$resourceId}")) {
abort(403);
}
return $next($request);
};
}
public static function createSymfonyEventListener(AuthorizationService $auth): \Closure
{
return function ($event) use ($auth) {
$request = $event->getRequest();
$relation = $request->attributes->get('_openfga_relation');
if (!$relation) {
return; // No authorization required
}
// Extract user and resource from request
// Implementation depends on your setup
};
}
}
```
#### Testing Integration
##### Mock Service for Tests
Create a mock authorization service for testing:
```php
class MockAuthorizationService implements AuthorizationInterface
{
private array $permissions = [];
public function __construct() {}
public function can(string $userId, string $relation, string $resource): bool
{
return $this->permissions["{$userId}:{$relation}:{$resource}"] ?? false;
}
public function grant(string $userId, string $relation, string $resource): void
{
$this->permissions["{$userId}:{$relation}:{$resource}"] = true;
}
public function revoke(string $userId, string $relation, string $resource): void
{
unset($this->permissions["{$userId}:{$relation}:{$resource}"]);
}
// Test helper methods
public function grantPermission(string $userId, string $relation, string $resource): void
{
$this->grant($userId, $relation, $resource);
}
public function clearPermissions(): void
{
$this->permissions = [];
}
}
```
Use in your tests:
```php
class DocumentControllerTest extends TestCase
{
private MockAuthorizationService $auth;
protected function setUp(): void
{
parent::setUp();
$this->auth = new MockAuthorizationService([]);
$this->app->instance(AuthorizationService::class, $this->auth);
}
public function testUserCanViewDocument(): void
{
$user = User::factory()->create();
$document = Document::factory()->create();
// Grant permission in mock
$this->auth->grantPermission($user->id, 'viewer', "document:{$document->id}");
$response = $this->actingAs($user)->get("/documents/{$document->id}");
$response->assertOk();
}
public function testUserCannotEditWithoutPermission(): void
{
$user = User::factory()->create();
$document = Document::factory()->create();
$response = $this->actingAs($user)->put("/documents/{$document->id}");
$response->assertForbidden();
}
}
```
<!-- End of evansims/openfga-php/docs/Features/Integration.md -->
<!-- Source: evansims/openfga-php/docs/Features/Observability.md -->
The OpenFGA PHP SDK includes comprehensive OpenTelemetry support for observability, providing distributed tracing, metrics collection, and telemetry data to help you monitor, debug, and optimize your authorization workflows. Whether you're troubleshooting performance issues or gaining insights into your application's authorization patterns, the SDK's telemetry features give you the visibility you need.
**New to OpenTelemetry?** It's an open-source observability framework that helps you collect, process, and export telemetry data (metrics, logs, and traces) from your applications. Think of it as a way to understand what your application is doing under the hood.
**Already using OpenTelemetry?** The SDK integrates seamlessly with your existing setup - just configure your telemetry provider and start getting insights into your OpenFGA operations automatically.
#### What you get
The SDK automatically instruments and provides telemetry for:
- **HTTP Requests:** All API calls to OpenFGA, including timing, status codes, and errors
- **OpenFGA Operations:** Business-level operations like `check()`, `listObjects()`, `writeTuples()`, etc.
- **Retry Logic:** Failed requests, retry attempts, and backoff delays
- **Circuit Breaker:** State changes and failure rate tracking
- **Authentication:** Token requests, refreshes, and authentication events
#### Prerequisites
All examples in this guide assume the following setup:
**Requirements:**
- **PHP 8.3+** with the OpenFGA PHP SDK installed
- **OpenTelemetry PHP packages** (optional, but recommended for full functionality):
```bash
composer require open-telemetry/api open-telemetry/sdk
```
- **An OpenTelemetry processing/exporting setup.** While not strictly required to enable telemetry in the SDK, you'll need a way to process and view your telemetry data. This can range from a simple console exporter for local development, a local Jaeger/Zipkin instance, to a full cloud-based observability service.
**Common imports and setup code:**
```php
require_once __DIR__ . '/vendor/autoload.php';
// OpenFGA SDK imports
use OpenFGA\Client;
use OpenFGA\Observability\TelemetryFactory;
// OpenTelemetry imports (when using full OpenTelemetry setup)
use OpenTelemetry\API\Globals;
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\Contrib\Otlp\SpanExporter;
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
use OpenTelemetry\SDK\Trace\TracerProvider;
// Event-driven telemetry imports
use OpenFGA\Events\{
EventDispatcher,
HttpRequestSentEvent,
HttpResponseReceivedEvent,
OperationCompletedEvent,
OperationStartedEvent
};
// Helper functions for common operations
use function OpenFGA\{allowed, dsl, model, store, tuple, tuples, write};
// Basic client configuration (customize for your environment)
$apiUrl = $_ENV['FGA_API_URL'] ?? 'http://localhost:8080';
$storeId = $_ENV['FGA_STORE_ID'] ?? 'your-store-id';
$modelId = $_ENV['FGA_MODEL_ID'] ?? 'your-model-id';
```
#### Quickstart
For production use with a telemetry backend, install the OpenTelemetry packages and configure them:
```bash
composer require open-telemetry/api open-telemetry/sdk
```
```php
// Configure OpenTelemetry (this is a basic example)
$tracerProvider = new TracerProvider([
new SimpleSpanProcessor(
new SpanExporter($_ENV['OTEL_EXPORTER_OTLP_ENDPOINT'] ?? 'http://localhost:4317')
)
]);
Globals::registerInitializer(function () use ($tracerProvider) {
return \OpenTelemetry\SDK\Registry::get()->tracerProvider($tracerProvider);
});
// Create telemetry with your service information
$telemetry = TelemetryFactory::create(
serviceName: 'my-authorization-service',
serviceVersion: '1.2.3'
);
// Configure client
$client = new Client(
url: $apiUrl,
telemetry: $telemetry
);
// Operations are now traced and exported to your backend
$result = $client->listObjects(
store: $storeId,
model: $modelId,
user: 'user:anne',
relation: 'viewer',
type: 'document'
);
```
#### Telemetry data collected
##### HTTP request telemetry
Every HTTP request to the OpenFGA API is automatically instrumented:
**Traces (Spans):**
- Span name: `HTTP {METHOD}` (for example `HTTP POST`)
- Duration of the entire HTTP request/response cycle
- HTTP method, URL, status code, response size
- Error details if the request fails
**Metrics:**
- `openfga.http.requests.total` - Counter of HTTP requests by method, status code, and success/failure
**Example span attributes:**
```
http.method: POST
http.url: https://api.fga.example/stores/123/check
http.scheme: https
http.host: api.fga.example
http.status_code: 200
http.response.size: 1024
openfga.sdk.name: openfga-php
openfga.sdk.version: 1.0.0
```
##### OpenFGA operation telemetry
Business-level operations provide higher-level observability:
**Traces (Spans):**
- Span name: `openfga.{operation}` (for example `openfga.check`, `openfga.write_tuples`)
- Duration of the business operation (may include multiple HTTP calls)
- Store ID, model ID, and operation-specific metadata
**Metrics:**
- `openfga.operations.total` - Counter of operations by type, store, success/failure
- `openfga.operations.duration` - Histogram of operation durations
**Example operation span:**
```
openfga.operation: check
openfga.store_id: store_01H1234567890ABCDEF
openfga.model_id: model_01H1234567890ABCDEF
openfga.sdk.name: openfga-php
openfga.sdk.version: 1.0.0
```
##### Retry and reliability telemetry
The SDK automatically tracks retry attempts and circuit breaker behavior:
**Retry Metrics:**
- `openfga.retries.total` - Counter of retry attempts by endpoint and outcome
- `openfga.retries.delay` - Histogram of retry delays in milliseconds
**Circuit Breaker Metrics:**
- `openfga.circuit_breaker.state_changes.total` - Counter of state changes (open/closed)
**Authentication Telemetry:**
- `openfga.auth.events.total` - Counter of authentication events
- `openfga.auth.duration` - Histogram of authentication operation durations
#### Configuration options
##### Service identification
Configure your service information for better observability:
```php
$telemetry = TelemetryFactory::create(
serviceName: 'user-management-api', // Your service name
serviceVersion: '2.1.0' // Your service version
);
```
##### Custom telemetry Providers
You can provide your own configured OpenTelemetry tracer and meter:
```php
// Get your configured tracer and meter
$tracer = Globals::tracerProvider()->getTracer('my-service', '1.0.0');
$meter = Globals::meterProvider()->getMeter('my-service', '1.0.0');
// Create telemetry with custom providers
$telemetry = TelemetryFactory::createWithCustomProviders($tracer, $meter);
$client = new Client(
url: $apiUrl,
telemetry: $telemetry
);
```
#### Common integration Patterns
##### Jaeger (Local development)
For local development with Jaeger:
```bash
# Start Jaeger with Docker
docker run -d --name jaeger \
-p 16686:16686 \
-p 14250:14250 \
jaegertracing/all-in-one:latest
```
```php
use OpenTelemetry\Contrib\Jaeger\Exporter as JaegerExporter;
$tracerProvider = new TracerProvider([
new SimpleSpanProcessor(
new JaegerExporter(
'my-service',
'http://localhost:14268/api/traces'
)
)
]);
Globals::registerInitializer(function () use ($tracerProvider) {
return \OpenTelemetry\SDK\Registry::get()->tracerProvider($tracerProvider);
});
$telemetry = TelemetryFactory::create('my-service', '1.0.0');
```
##### Cloud providers
For cloud-based observability services:
```php
// AWS X-Ray, Google Cloud Trace, Azure Monitor, etc.
$exporter = new SpanExporter($_ENV['OTEL_EXPORTER_OTLP_ENDPOINT']);
// Configure with your cloud provider's specific settings
```
##### Existing openTelemetry Setup
If you already have OpenTelemetry configured in your application:
```php
// The SDK will automatically use your existing global configuration
$telemetry = TelemetryFactory::create('my-authorization-service');
$client = new Client(
url: $apiUrl,
telemetry: $telemetry
);
// Traces will be included in your existing observability setup
```
#### Example: Complete authorization workflow with tracing
Here's a complete example showing how telemetry works throughout an authorization workflow:
```php
// Configure telemetry (assumes OpenTelemetry is set up)
$telemetry = TelemetryFactory::create(
serviceName: 'document-service',
serviceVersion: '1.0.0'
);
$client = new Client(
url: $apiUrl,
telemetry: $telemetry
);
try {
// Each operation creates its own span with timing and metadata
// 1. Create store - traced as "openfga.create_store"
$store = $client->createStore(name: 'document-service-store')
->unwrap();
// 2. Create model - traced as "openfga.create_authorization_model"
$model = $client->createAuthorizationModel(
store: $store->getId(),
typeDefinitions: $authModel->getTypeDefinitions()
)->unwrap();
// 3. Write relationships - traced as "openfga.write_tuples"
$client->writeTuples(
store: $store->getId(),
model: $model->getId(),
writes: tuples(
tuple(user: 'user:anne', relation: 'viewer', object: 'document:readme'),
tuple(user: 'user:bob', relation: 'editor', object: 'document:readme')
)
)->unwrap();
// 4. Check authorization - traced as "openfga.check"
$allowed = $client->check(
store: $store->getId(),
model: $model->getId(),
tupleKey: tuple(user: 'user:anne', relation: 'viewer', object: 'document:readme')
)->unwrap();
// 5. List accessible objects - traced as "openfga.list_objects"
$documents = $client->listObjects(
store: $store->getId(),
model: $model->getId(),
user: 'user:anne',
relation: 'viewer',
type: 'document'
)->unwrap();
echo "Authorization check complete. Anne can view document: " .
($allowed->getAllowed() ? 'Yes' : 'No') . "\n";
echo "Documents Anne can view: " . count($documents->getObjects()) . "\n";
} catch (Throwable $e) {
// Errors are automatically recorded in spans
echo "Authorization failed: " . $e->getMessage() . "\n";
}
```
#### Viewing your Telemetry Data
##### In jaeger UI
1. Open http://localhost:16686 in your browser
2. Select your service name from the dropdown
3. Click "Find Traces" to see recent authorization operations
4. Click on a trace to see the detailed span timeline
##### Key things to Look For
**Performance Analysis:**
- Which operations take the longest?
- Are there patterns in slow requests?
- How do retry attempts affect overall timing?
**Error Investigation:**
- What HTTP status codes are you getting?
- Which OpenFGA operations are failing?
- Are authentication issues causing problems?
**Usage Patterns:**
- Which stores and models are accessed most frequently?
- What types of authorization checks are most common?
- How often do retries occur?
#### Troubleshooting
##### No telemetry Data
1. **Check if OpenTelemetry is properly installed:**
```bash
composer show | grep open-telemetry
```
2. **Verify your exporter configuration:**
```php
// Add debug output
$telemetry = TelemetryFactory::create('test-service');
if ($telemetry instanceof \OpenFGA\Observability\OpenTelemetryProvider) {
echo "Using OpenTelemetry provider\n";
} elseif ($telemetry === null) {
echo "No telemetry configured\n";
}
```
3. **Check your backend connectivity:**
- Ensure your OTLP endpoint is reachable
- Verify authentication if required
- Check firewall and network settings
##### Performance impact
The telemetry overhead is minimal in production:
- **No-op mode:** Virtually zero overhead when telemetry is disabled
- **OpenTelemetry mode:** Low overhead (~1-2% typically) with async exporters
- **Graceful degradation:** Continues working even if telemetry backend is unavailable
##### Environment variables
Common OpenTelemetry environment variables that work with the SDK:
```bash
# Service identification
export OTEL_SERVICE_NAME="my-authorization-service"
export OTEL_SERVICE_VERSION="1.0.0"
# Exporter configuration
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_EXPORTER_OTLP_HEADERS="api-key=your-api-key"
# Sampling (to reduce overhead in high-traffic scenarios)
export OTEL_TRACES_SAMPLER="traceidratio"
export OTEL_TRACES_SAMPLER_ARG="0.1" # Sample 10% of traces
```
#### Event-driven telemetry
The SDK provides a powerful event-driven telemetry system that allows you to create custom observability solutions without tight coupling to the main client functionality. This approach lets you build specialized listeners for different concerns like logging, metrics collection, alerting, or custom analytics.
##### Available events
The SDK emits events at key points during operation execution:
- **`OperationStartedEvent`** **OperationStartedEvent** - When an OpenFGA operation begins (check, write, etc.)
- **`OperationCompletedEvent`** **OperationCompletedEvent** - When an operation finishes (success or failure)
- **`HttpRequestSentEvent`** **HttpRequestSentEvent** - When HTTP requests are sent to the OpenFGA API
- **`HttpResponseReceivedEvent`** **HttpResponseReceivedEvent** - When HTTP responses are received
##### Creating custom Event Listeners
Here's how to create and register custom event listeners:
```php
// Create a logging listener
// Note: This is an example helper class and not part of the SDK.
final class LoggingEventListener
{
public function onHttpRequestSent(HttpRequestSentEvent $event): void
{
echo "[{$event->getOperation()}] HTTP Request: {$event->getRequest()->getMethod()} {$event->getRequest()->getUri()}\n";
}
public function onHttpResponseReceived(HttpResponseReceivedEvent $event): void
{
$status = $event->getResponse() ? $event->getResponse()->getStatusCode() : 'N/A';
$success = $event->isSuccessful() ? '✅' : '❌';
echo "[{$event->getOperation()}] HTTP Response: {$success} {$status}\n";
}
public function onOperationStarted(OperationStartedEvent $event): void
{
echo "[{$event->getOperation()}] Started - Store: {$event->getStoreId()}\n";
}
public function onOperationCompleted(OperationCompletedEvent $event): void
{
$success = $event->isSuccessful() ? '✅' : '❌';
echo "[{$event->getOperation()}] Completed: {$success}\n";
}
}
// Create a metrics listener
// Note: This is an example helper class and not part of the SDK.
final class MetricsEventListener
{
private array $operationTimes = [];
private array $requestCounts = [];
public function onOperationStarted(OperationStartedEvent $event): void
{
$this->operationTimes[$event->getEventId()] = microtime(true);
}
public function onOperationCompleted(OperationCompletedEvent $event): void
{
$operation = $event->getOperation();
// Count operations
$this->requestCounts[$operation] = ($this->requestCounts[$operation] ?? 0) + 1;
// Track timing
if (isset($this->operationTimes[$event->getEventId()])) {
$duration = microtime(true) - $this->operationTimes[$event->getEventId()];
echo "[{$operation}] completed in " . round($duration * 1000, 2) . "ms\n";
unset($this->operationTimes[$event->getEventId()]);
}
}
public function getMetrics(): array
{
return [
'request_counts' => $this->requestCounts,
'active_operations' => count($this->operationTimes),
];
}
}
```
##### Registering event Listeners
Register your listeners with the event dispatcher:
```php
// Create event dispatcher and listeners
$eventDispatcher = new EventDispatcher();
$loggingListener = new LoggingEventListener();
$metricsListener = new MetricsEventListener();
// Register listeners for different events
$eventDispatcher->addListener(HttpRequestSentEvent::class, [$loggingListener, 'onHttpRequestSent']);
$eventDispatcher->addListener(HttpResponseReceivedEvent::class, [$loggingListener, 'onHttpResponseReceived']);
$eventDispatcher->addListener(OperationStartedEvent::class, [$loggingListener, 'onOperationStarted']);
$eventDispatcher->addListener(OperationCompletedEvent::class, [$loggingListener, 'onOperationCompleted']);
// Register metrics listener
$eventDispatcher->addListener(OperationStartedEvent::class, [$metricsListener, 'onOperationStarted']);
$eventDispatcher->addListener(OperationCompletedEvent::class, [$metricsListener, 'onOperationCompleted']);
// Note: In production, you would configure the event dispatcher through dependency injection
// The above example shows the concept for educational purposes
```
##### Complete event-Driven Example
Here's a complete example showing event-driven telemetry in action:
```php
// Your custom listeners (defined above)
$eventDispatcher = new EventDispatcher();
$loggingListener = new LoggingEventListener();
$metricsListener = new MetricsEventListener();
// Register all listeners
$eventDispatcher->addListener(HttpRequestSentEvent::class, [$loggingListener, 'onHttpRequestSent']);
$eventDispatcher->addListener(HttpResponseReceivedEvent::class, [$loggingListener, 'onHttpResponseReceived']);
$eventDispatcher->addListener(OperationStartedEvent::class, [$loggingListener, 'onOperationStarted']);
$eventDispatcher->addListener(OperationCompletedEvent::class, [$loggingListener, 'onOperationCompleted']);
$eventDispatcher->addListener(OperationStartedEvent::class, [$metricsListener, 'onOperationStarted']);
$eventDispatcher->addListener(OperationCompletedEvent::class, [$metricsListener, 'onOperationCompleted']);
$client = new Client(
url: $apiUrl,
eventDispatcher: $eventDispatcher,
);
// Perform operations - events will be triggered automatically
$storeId = store($client, 'telemetry-demo');
$authModel = dsl($client, '
model
schema 1.1
type user
type document
relations
define viewer: [user]
');
$modelId = model($client, $storeId, $authModel);
write($client, $storeId, $modelId, tuple('user:alice', 'viewer', 'document:report'));
$canView = allowed($client, $storeId, $modelId, tuple('user:alice', 'viewer', 'document:report'));
// View collected metrics
echo "Collected Metrics:\n";
print_r($metricsListener->getMetrics());
```
##### Production use Cases
**Custom Alerting:**
```php
// Note: This is an example helper class and not part of the SDK.
final class AlertingEventListener
{
public function onOperationCompleted(OperationCompletedEvent $event): void
{
if (!$event->isSuccessful()) {
// Send alert to your monitoring system
$this->sendAlert([
'operation' => $event->getOperation(),
'store_id' => $event->getStoreId(),
'error' => $event->getException()?->getMessage(),
]);
}
}
private function sendAlert(array $data): void
{
// Integration with your alerting system
// Example: PagerDuty, Slack, email, etc.
$alertPayload = json_encode([
'severity' => 'warning',
'summary' => "OpenFGA operation failed: {$data['operation']}",
'details' => $data,
'timestamp' => date('c'),
]);
// Send to your alerting endpoint
// curl_post($alertingEndpoint, $alertPayload);
}
}
```
**Security Monitoring:**
```php
// Note: This is an example helper class and not part of the SDK.
final class SecurityEventListener
{
public function onOperationStarted(OperationStartedEvent $event): void
{
if ($event->getOperation() === 'check') {
// Log authorization attempts for security analysis
$this->logSecurityEvent([
'timestamp' => time(),
'operation' => $event->getOperation(),
'store_id' => $event->getStoreId(),
'user_ip' => $_SERVER['REMOTE_ADDR'] ?? 'unknown',
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'unknown',
]);
}
}
private function logSecurityEvent(array $event): void
{
// Send to security information and event management (SIEM) system
$securityLog = json_encode([
'event_type' => 'authorization_check',
'metadata' => $event,
]);
// Log to security monitoring system
error_log($securityLog, 3, '/var/log/security/openfga.log');
}
}
```
**Performance Analytics:**
```php
// Note: This is an example helper class and not part of the SDK.
final class PerformanceEventListener
{
private array $operationTimings = [];
public function onOperationStarted(OperationStartedEvent $event): void
{
$this->operationTimings[$event->getEventId()] = microtime(true);
}
public function onOperationCompleted(OperationCompletedEvent $event): void
{
$timing = $this->calculateTiming($event);
// Export to your analytics platform
$this->exportToAnalytics([
'operation' => $event->getOperation(),
'duration_ms' => $timing,
'store_id' => $event->getStoreId(),
'success' => $event->isSuccessful(),
'timestamp' => time(),
]);
}
private function calculateTiming(OperationCompletedEvent $event): float
{
$startTime = $this->operationTimings[$event->getEventId()] ?? microtime(true);
return (microtime(true) - $startTime) * 1000; // Convert to milliseconds
}
private function exportToAnalytics(array $data): void
{
// Send to analytics platform (Google Analytics, Mixpanel, etc.)
$analyticsPayload = json_encode([
'event_name' => 'openfga_operation',
'properties' => $data,
]);
// Send to analytics endpoint
// $this->analyticsClient->track($analyticsPayload);
}
}
```
##### Benefits of event-driven telemetry
- **Decoupling:** Observability logic is separate from business logic
- **Flexibility:** Add multiple listeners for the same events
- **Specialization:** Create focused listeners for different concerns
- **Testability:** Easy to unit test telemetry functionality in isolation
- **Extensibility:** Add new observability features without changing core code
- **Custom Integration:** Perfect for integrating with proprietary monitoring systems
##### Integration with dependency injection
In production applications, register listeners through your DI container:
```php
// In your service provider or DI configuration
$container->singleton(EventDispatcher::class, function () {
$dispatcher = new EventDispatcher();
// Register all your listeners
$dispatcher->addListener(OperationStartedEvent::class, [LoggingEventListener::class, 'onOperationStarted']);
$dispatcher->addListener(OperationCompletedEvent::class, [MetricsEventListener::class, 'onOperationCompleted']);
$dispatcher->addListener(OperationCompletedEvent::class, [AlertingEventListener::class, 'onOperationCompleted']);
$dispatcher->addListener(OperationStartedEvent::class, [SecurityEventListener::class, 'onOperationStarted']);
// ... more listeners
return $dispatcher;
});
// Configure the client to use the dispatcher
$container->singleton(Client::class, function ($container) {
return new Client(
url: $apiUrl,
eventDispatcher: $container->get(EventDispatcher::class),
);
});
```
#### Advanced openTelemetry Integration
##### Custom attributes
Add custom context to your authorization operations:
```php
// The SDK automatically includes relevant attributes, but you can add more context
// when configuring your service or through OpenTelemetry's context propagation
// Add custom attributes to the current span
$span = Span::getCurrent();
$span->setAttribute('user.department', 'engineering');
$span->setAttribute('request.source', 'mobile-app');
$span->setAttribute('tenant.id', $tenantId);
$span->setAttribute('session.id', $sessionId);
// Now perform your authorization check
$result = $client->check(
store: $storeId,
model: $modelId,
tupleKey: tuple(user: 'user:anne', relation: 'viewer', object: 'document:readme')
);
```
##### Correlation with application traces
The SDK integrates with your application's existing traces:
```php
// If you have an existing span (for example from a web request)
$parentSpan = $yourFramework->getCurrentSpan();
// OpenFGA operations will automatically become child spans
$result = $client->check(
store: $storeId,
model: $modelId,
tupleKey: tuple(user: 'user:anne', relation: 'viewer', object: 'document:readme')
); // This becomes a child of $parentSpan
```
##### Distributed tracing Across Services
When your authorization spans multiple services:
```php
// Service A: Create a span and propagate context
$tracer = Globals::tracerProvider()->getTracer('user-service');
$span = $tracer->spanBuilder('authorize_user_access')->startSpan();
// Inject trace context into headers for service-to-service calls
$headers = [];
TraceContextPropagator::getInstance()->inject($headers);
// Service B: Extract context and continue the trace
$extractedContext = TraceContextPropagator::getInstance()->extract($headers);
Context::storage()->attach($extractedContext);
// OpenFGA operations will continue the distributed trace
$allowed = $client->check(
store: $storeId,
model: $modelId,
tupleKey: tuple(user: 'user:anne', relation: 'viewer', object: 'document:readme')
);
```
##### Metrics-only mode
If you only want metrics without distributed tracing:
```php
// Configure OpenTelemetry with metrics only
use OpenTelemetry\SDK\Metrics\MeterProvider;
use OpenTelemetry\Contrib\Otlp\MetricExporter;
$meterProvider = new MeterProvider([
new MetricExporter($_ENV['OTEL_EXPORTER_OTLP_ENDPOINT'])
]);
// Don't configure a tracer provider - only metrics will be collected
$telemetry = TelemetryFactory::create('my-service');
```
##### Custom sampling Strategies
For high-traffic applications, implement custom sampling:
```php
// Custom sampler based on operation type
use OpenTelemetry\SDK\Trace\Sampler\ParentBased;
use OpenTelemetry\SDK\Trace\Sampler\TraceIdRatioBasedSampler;
$customSampler = new ParentBased(
new TraceIdRatioBasedSampler(0.1) // Sample 10% of traces
);
$tracerProvider = new TracerProvider([
new SimpleSpanProcessor($exporter)
], sampler: $customSampler);
```
#### Advanced monitoring Patterns
##### Circuit breaker Monitoring
Monitor and alert on circuit breaker state changes:
```php
// Note: This is an example helper class and not part of the SDK.
final class CircuitBreakerEventListener
{
public function onOperationCompleted(OperationCompletedEvent $event): void
{
// Check if the failure rate indicates circuit breaker activation
$failureRate = $this->calculateFailureRate($event->getStoreId());
if ($failureRate > 0.5) { // 50% failure threshold
$this->alertCircuitBreakerRisk([
'store_id' => $event->getStoreId(),
'failure_rate' => $failureRate,
'operation' => $event->getOperation(),
]);
}
}
private function calculateFailureRate(string $storeId): float
{
// Calculate failure rate for the store over recent operations
// This would integrate with your metrics storage
return 0.0; // Placeholder
}
}
```
##### A/B Testing Integration
Track authorization model performance across different versions:
```php
// Note: This is an example helper class and not part of the SDK.
final class ABTestingEventListener
{
public function onOperationCompleted(OperationCompletedEvent $event): void
{
$this->trackModelPerformance([
'model_id' => $event->getModelId(),
'operation' => $event->getOperation(),
'duration_ms' => $event->getDuration(),
'success' => $event->isSuccessful(),
'variant' => $this->getModelVariant($event->getModelId()),
]);
}
private function getModelVariant(string $modelId): string
{
// Determine which A/B test variant this model represents
return 'control'; // or 'treatment'
}
}
```
##### SLA Monitoring
Track service level objectives:
```php
// Note: This is an example helper class and not part of the SDK.
final class SLAEventListener
{
private const SLO_LATENCY_MS = 100; // 100ms SLO
private const SLO_SUCCESS_RATE = 0.999; // 99.9% success rate
public function onOperationCompleted(OperationCompletedEvent $event): void
{
$this->recordSLAMetrics([
'operation' => $event->getOperation(),
'latency_slo_met' => $event->getDuration() <= self::SLO_LATENCY_MS,
'success_slo_met' => $event->isSuccessful(),
'timestamp' => time(),
]);
}
private function recordSLAMetrics(array $metrics): void
{
// Send to SLA monitoring dashboard
// Track error budget consumption
}
}
```
#### Testing advanced Observability
##### Unit testing Event Listeners
```php
use PHPUnit\Framework\TestCase;
class SecurityEventListenerTest extends TestCase
{
public function testLogsSecurityEventForCheckOperations(): void
{
$listener = new SecurityEventListener();
$event = new OperationStartedEvent(
eventId: 'test-123',
operation: 'check',
storeId: 'store-123'
);
// Capture log output
ob_start();
$listener->onOperationStarted($event);
$output = ob_get_clean();
$this->assertStringContainsString('authorization_check', $output);
$this->assertStringContainsString('store-123', $output);
}
}
```
##### Integration testing with Telemetry
```php
class TelemetryIntegrationTest extends TestCase
{
public function testOperationCreatesExpectedSpans(): void
{
// Configure test tracer
$spanProcessor = new InMemorySpanProcessor();
$tracerProvider = new TracerProvider([$spanProcessor]);
$telemetry = TelemetryFactory::createWithCustomProviders(
$tracerProvider->getTracer('test'),
null
);
$client = new Client(
url: 'http://localhost:8080',
telemetry: $telemetry
);
// Perform operation
$client->check(
store: 'test-store',
model: 'test-model',
tupleKey: tuple('user:test', 'viewer', 'doc:test')
);
// Assert spans were created
$spans = $spanProcessor->getSpans();
$this->assertCount(2, $spans); // HTTP + operation spans
$this->assertEquals('openfga.check', $spans[1]->getName());
}
}
```
<!-- End of evansims/openfga-php/docs/Features/Observability.md -->
<!-- Source: evansims/openfga-php/docs/Features/Results.md -->
#### Prerequisites
The examples in this guide assume you have the following setup:
```php
use OpenFGA\{Client, ClientInterface};
use OpenFGA\Models\{Store, AuthorizationModel};
use OpenFGA\Exceptions\{ClientError, ClientException, NetworkError, NetworkException};
use function OpenFGA\{result, ok, err, unwrap, success, failure, tuple, allowed};
$client = new Client(url: 'http://localhost:8080');
$storeId = $_ENV['FGA_STORE_ID'] ?? 'your-store-id';
$modelId = $_ENV['FGA_MODEL_ID'] ?? 'your-model-id';
$store = $client->getStore($storeId)->unwrap();
$model = $client->getAuthorizationModel($storeId, $modelId)->unwrap();
```
#### Why use Results
The OpenFGA SDK uses Results to make error handling explicit and chainable:
```php
// Instead of this mess:
try {
$store = $client->getStore($storeId);
try {
$model = $client->getAuthorizationModel($store->getId(), $modelId);
// Do something with $model
} catch (Exception $e) {
// Handle model error
}
} catch (Exception $e) {
// Handle store error
}
// You get this:
$client->getStore($storeId)
->then(fn($store) => $client->getAuthorizationModel($store->getId(), $modelId))
->success(fn($model) => $this->processModel($model))
->failure(fn($error) => $this->logError($error));
```
All SDK methods return either [`Success`](https://github.com/evansims/openfga-php/blob/main/../API/Results/Success.md) or [`Failure`](https://github.com/evansims/openfga-php/blob/main/../API/Results/Failure.md) objects instead of throwing exceptions for expected failures like "not found" or validation errors.
#### Basic usage
The most common patterns you'll need:
##### Just get the value
```php
// Get the value or throw on failure
$store = $client->getStore($storeId)->unwrap();
// Get the value with a fallback
$store = $client->getStore($storeId)->unwrap(fn($error) => /* fallback */);
```
##### Handle success and failure
```php
$result = $client->createStore(name: 'my-store');
$result
->success(fn($store) => logger()->info("Created store: {$store->getId()}"))
->failure(fn($error) => logger()->error("Failed: {$error->getMessage()}"));
```
##### Check the outcome
```php
if ($result->succeeded()) {
$store = $result->unwrap();
// Do something with $store
}
if ($result->failed()) {
$error = $result->err();
// Handle the error
}
```
#### Chaining operations
Results really shine when you need to chain multiple operations:
##### Transform success values with `then()`
```php
$result = $client->getStore($storeId)
->then(fn($store) => $client->getAuthorizationModel($store->getId(), $modelId))
->then(fn($model) => $this->processModel($model));
```
##### Provide fallbacks with `recover()`
```php
$model = $client->getAuthorizationModel($storeId, $modelId)
->recover(fn($error) => $this->getDefaultModel())
->unwrap();
```
##### Pipeline with side effects
```php
$tuples = [/* your tuples here */];
$client->writeTuples($store, $model, $tuples)
->success(fn($response) => $this->logSuccess($response))
->failure(fn($error) => $this->logError($error))
->then(fn($response) => $this->notifyWebhooks($response))
->recover(fn($error) => $this->handleFailure($error));
```
#### Error handling patterns
##### Fail gracefully with helper functions
```php
// Return a sensible default when things go wrong
function getUserPermissions(string $userId): array
{
return result(function() use ($userId) {
return $this->client->listObjects(
user: $userId,
relation: 'can_access'
);
})
->then(fn($response) => $response->getObjects())
->recover(function(Throwable $error) {
logger()->warning('Failed to get user permissions', [
'error_type' => $error::class,
'message' => $error->getMessage()
]);
return []; // Empty permissions on error
})
->unwrap();
}
```
##### Handling specific error types with enum-based exceptions
```php
function canUserAccess(string $userId, string $documentId): bool
{
// Call client->check() to get a ResultInterface object
$result = $this->client->check(
store: $this->storeId,
model: $this->modelId,
tupleKey: tuple("user:{$userId}", 'viewer', "document:{$documentId}")
);
// Check if the operation failed
if ($result->failed()) {
$error = $result->err(); // Get the actual error/exception
// Handle specific enum-based ClientException errors
if ($error instanceof ClientException) {
return match($error->getError()) { // getError() returns the enum
// Network errors can be retried
ClientError::Network => $this->retryAfterDelay(function() use ($userId, $documentId) {
// Recursive call or re-attempt logic
return $this->canUserAccess($userId, $documentId);
}, $maxRetries = 3),
// Authentication errors should trigger re-auth
ClientError::Authentication => $this->handleAuthError($error), // Pass the error object
// Fall back to cached permissions for other client errors
default => $this->getCachedPermission($userId, $documentId, false)
};
}
// Handle other types of Throwable or log unexpected errors
logger()->error('Unexpected error checking permissions', [
'error_type' => $error::class,
'message' => $error->getMessage(),
'user' => $userId,
'document' => $documentId
]);
return false; // Secure default for unhandled errors
}
// If successful, unwrap to get the CheckResponse and then getAllowed()
return $result->unwrap()->getAllowed();
}
```
##### Collect multiple results
```php
$userId = 'user:anne';
$resourceId = 'document:budget-2024';
$permissions = collect(['read', 'write', 'delete'])
->map(fn($action) => $client->check(user: $userId, relation: $action, object: $resourceId))
->filter(fn($result) => $result->succeeded())
->map(fn($result) => $result->unwrap()->getAllowed())
->toArray();
```
##### Add context to errors
```php
$tuples = [/* your tuples here */];
$result = $client->writeTuples($store, $model, $tuples)
->failure(function(Throwable $e) use ($store, $tuples) {
logger()->error("Failed to write tuples to store {$store->getId()}", [
'error' => $e->getMessage(),
'tuples_count' => count($tuples)
]);
});
```
##### Convert errors to application exceptions
```php
$model = $client->getAuthorizationModel($storeId, $modelId)
->recover(fn($error) => throw new ModelNotFoundException($modelId, previous: $error))
->unwrap();
```
#### Advanced patterns
##### Retry with exponential backoff
```php
function checkWithRetry(string $user, string $relation, string $object): bool
{
return retry(3, function() use ($user, $relation, $object) {
return $this->client->check(
user: $user,
relation: $relation,
object: $object
)->unwrap()->getAllowed();
}, sleepMilliseconds: fn($attempt) => $attempt * 1000);
}
```
##### Batch operations with partial failures
```php
function batchCheck(array $checks): array
{
return collect($checks)
->map(fn($check) => $this->client->check(...$check))
->map(fn($result, $index) => [
'index' => $index,
'allowed' => $result->succeeded() && $result->unwrap()->getAllowed(),
'error' => $result->failed() ? $result->err()->getMessage() : null
])
->toArray();
}
```
##### Framework integration
###### Laravel Service
```php
// Note: This is an example helper class for a Laravel application and not part of the SDK.
class PermissionService
{
public function __construct(
private ClientInterface $client,
private string $storeId,
private string $modelId
) {}
public function can(string $user, string $action, string $resource): bool
{
return $this->client
->check(
store: $this->storeId,
model: $this->modelId,
tupleKey: tuple($user, $action, $resource)
)
->then(fn($response) => $response->getAllowed())
->recover(function(Throwable $e) {
Log::warning('Permission check failed', [
'user' => $user,
'action' => $action,
'resource' => $resource,
'error' => $e->getMessage()
]);
return false; // Fail closed
})
->unwrap();
}
}
```
###### Symfony Voter
```php
class FgaVoter extends Voter
{
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
{
return $this->client
->check(
store: $this->store,
model: $this->model,
tupleKey: tuple($token->getUserIdentifier(), $attribute, $subject->getId())
)
->then(fn($response) => $response->getAllowed())
->recover(fn() => false) // Deny on error
->unwrap();
}
}
```
#### When to use what
- **`unwrap()`** **unwrap()** - When you want simple exception-based error handling
- **`success()`** **success()** **/** **`failure()`** **failure()** - For side effects like logging without changing the result
- **`then()`** **then()** - To transform success values or chain operations
- **`recover()`** **recover()** - To provide fallbacks or convert failures to successes
The Result pattern makes error handling explicit and composable. Chain operations confidently knowing failures won't break your pipeline.
<!-- End of evansims/openfga-php/docs/Features/Results.md -->
<!-- Source: evansims/openfga-php/docs/Getting Started/Authentication.md -->
This guide shows you how to configure the SDK for various authentication methods and use cases.
#### Configurations
##### Client Credentials (OIDC)
This is the recommended authentication method when using the SDK with [Auth0 FGA](https://auth0.com/fine-grained-authorization). This configuration, the SDK handles OAuth token management automatically.
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/authentication-client-credentials.php#intro)
**Environment variables:**
```bash
FGA_API_URL=https://api.us1.fga.dev
FGA_CLIENT_ID=your_client_id
FGA_CLIENT_SECRET=your_client_secret
FGA_ISSUER=https://your-tenant.us.auth0.com/oauth/token
FGA_AUDIENCE=https://api.us1.fga.dev/
```
##### Pre-Shared Keys (API Tokens)
For simpler setups or self-hosted OpenFGA instances that support API tokens:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/authentication-pre-shared-key.php#intro)
**Environment variables:**
```bash
FGA_API_URL=https://your-openfga-server.com
FGA_API_TOKEN=your_api_token
```
#### Troubleshooting
##### Authentication failed
- Verify your environment variables are set correctly
- Check that your client ID and secret are valid
- Ensure the issuer URL includes the full path (for example `/oauth/token`)
##### Token expired errors
The SDK automatically refreshes tokens for Client Credentials authentication. If you're seeing expired token errors:
- Check your system clock is accurate
- Verify the audience URL is correct
##### Local development issues
If authentication isn't working locally:
- Confirm your OpenFGA server allows unauthenticated requests
- Check the server logs for authentication requirements
##### Environment variable loading
To load environment variables from a `.env` file, use a package like [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv):
```php
if (file_exists(__DIR__ . '/.env')) {
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
}
```
<!-- End of evansims/openfga-php/docs/Getting Started/Authentication.md -->
<!-- Source: evansims/openfga-php/docs/Getting Started/Installation.md -->
This guide walks you through installing the OpenFGA PHP SDK and setting up the necessary dependencies for your application.
#### Requirements
Before installing the SDK, ensure your environment meets these requirements:
- **PHP 8.3** or higher
- **Composer** (PHP dependency manager)
- **JSON extension** (usually enabled by default)
- **OpenSSL extension** (for HTTPS connections)
#### Installing the SDK
Install the OpenFGA PHP SDK using [Composer](https://getcomposer.org/):
```bash
composer require evansims/openfga-php
```
This command installs the SDK and its core dependencies. However, the SDK relies on [PSR standards](https://www.php-fig.org/psr/) for HTTP communication, which you'll need to provide.
#### PSR Dependencies
The OpenFGA SDK is built on [PHP Standards Recommendations (PSRs)](https://www.php-fig.org/psr/) for maximum compatibility with your existing application stack. It requires implementations of:
- [PSR-7](https://www.php-fig.org/psr/psr-7): HTTP message interfaces (requests and responses)
- [PSR-17](https://www.php-fig.org/psr/psr-17): HTTP factory interfaces (creating PSR-7 objects)
- [PSR-18](https://www.php-fig.org/psr/psr-18): HTTP client interface (sending HTTP requests)
If your application already uses a framework like Laravel, Symfony, or Slim, you likely have these implementations installed. If not, you'll need to install them.
##### Installing PSR Implementations
If your application is missing one or more of these implementations, you'll need to install dependencies to fill those gaps. [Guzzle](https://github.com/guzzle/guzzle) is a popular choice, and provides all three PSR implementations you'll need:
```bash
composer require guzzlehttp/guzzle guzzlehttp/psr7
```
##### Alternative PSR Implementations
You can choose different implementations based on your needs:
###### Lightweight option: Nyholm
For a more lightweight solution:
```bash
composer require nyholm/psr7 php-http/curl-client
```
###### Symfony Components
If you're using Symfony or prefer Symfony components:
```bash
composer require symfony/http-client nyholm/psr7
```
###### Laravel Projects
Laravel projects typically have Guzzle pre-installed. If not:
```bash
composer require guzzlehttp/guzzle
```
#### Common Installation Issues
##### Missing PSR Implementation
**Error:** `No PSR-18 HTTP Client implementation found`
**Solution:** Install a PSR-18 compatible HTTP client:
```bash
composer require guzzlehttp/guzzle
```
##### PHP Version Too Old
**Error:** `Your PHP version (8.x.x) does not satisfy requirements`
**Solution:** Upgrade to PHP 8.3 or higher (for example `sudo apt update && sudo apt install php8.3` on Ubuntu or `brew install php@8.3` on macOS).
##### Memory limit exceeded
**Error:** `Allowed memory size exhausted`
**Solution:** Increase Composer's memory limit:
```bash
COMPOSER_MEMORY_LIMIT=-1 composer require evansims/openfga-php
```
#### Development Installation
For contributing to the SDK or running tests:
```bash
git clone https://github.com/evansims/openfga-php.git
cd openfga-php
composer install
composer test
```
#### Docker Installation
If you prefer using Docker, create a `Dockerfile`:
```dockerfile
FROM php:8.3-cli
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install sockets
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /app
# Copy composer files
COPY composer.json composer.lock* ./
# Install dependencies
RUN composer install --no-scripts --no-autoloader
# Copy application code
COPY . .
# Generate autoloader
RUN composer dump-autoload --optimize
CMD ["php", "your-script.php"]
```
Build and run:
```bash
docker build -t openfga-php-app .
docker run --rm openfga-php-app
```
#### Production Considerations
When installing for production use:
1. **Use Composer's** **`--no-dev`** **--no-dev** **flag** to exclude development dependencies:
```bash
composer install --no-dev --optimize-autoloader
```
2. **Consider using a PSR-6 cache** for better performance:
```bash
composer require symfony/cache
```
#### Next Steps
Now that you have the SDK installed:
1. [Set up authentication](https://github.com/evansims/openfga-php/blob/main/Authentication.md) for secure API access
2. [Read the introduction](https://github.com/evansims/openfga-php/blob/main/Introduction.md) to understand core concepts
3. [Create your first store](https://github.com/evansims/openfga-php/blob/main/Introduction.md) to begin using OpenFGA
#### Troubleshooting
If you encounter issues during installation:
1. **Clear Composer's cache:**
```bash
composer clear-cache
```
2. **Update Composer itself:**
```bash
composer self-update
```
3. **Check for conflicts:**
```bash
composer diagnose
```
4. **Enable verbose output:**
```bash
composer require evansims/openfga-php -vvv
```
<!-- End of evansims/openfga-php/docs/Getting Started/Installation.md -->
<!-- Source: evansims/openfga-php/docs/Getting Started/Introduction.md -->
This guide takes you through building your first authorization. You'll install the SDK, connect to OpenFGA, and check your first permission.
#### Prerequisites
- PHP 8.3+ and Composer
- An [OpenFGA](https://openfga.dev) server (local or remote)
- [PSR-7](https://packagist.org/providers/psr/http-message-implementation), [PSR-17](https://packagist.org/providers/psr/http-factory-implementation) and [PSR-18](https://packagist.org/providers/psr/http-client-implementation) dependencies
#### Anatomy of authorization
Authorization with OpenFGA boils down to three things:
- A [store](https://github.com/evansims/openfga-php/blob/main/../Essentials/Stores.md), which acts like a database for your permissions.
- An [authorization model](https://github.com/evansims/openfga-php/blob/main/../Essentials/Models.md), which defines what permissions exist. Like "documents can have viewers and editors."
- The [relationship tuples](https://github.com/evansims/openfga-php/blob/main/../Essentials/Tuples.md), which establish specific permissions between users and resources. Like "Alice can view document:readme."
With those elements in place, you can then use [permission queries](https://github.com/evansims/openfga-php/blob/main/../Essentials/Queries.md) to have OpenFGA answer questions like "can Alice edit this document?"
#### Quickstart
##### 1. Start OpenFGA
The quickest method is Docker—one command gets you up and running:
```bash
docker run -d -p 8080:8080 --name openfga openfga/openfga run
```
Your server is now accessible at `http://localhost:8080`.
##### 2. Install the SDK
Use Composer to add the SDK to your application:
```bash
composer require evansims/openfga-php
```
In some cases you may need to [install additional dependencies](https://github.com/evansims/openfga-php/blob/main/Installation.md) for the SDK.
##### 3. Integrate the SDK
###### 3.1. Create a Client
Begin integrating the SDK by initializing an SDK Client in your application:
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/introduction-quickstart.php#intro)
In a production environment you'll want [authentication](https://github.com/evansims/openfga-php/blob/main/Authentication.md) and [error handling](https://github.com/evansims/openfga-php/blob/main/../Features/Results.md).
###### 3.2. Create a Store
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/introduction-quickstart.php#create-a-store)
###### 3.3 Define a Model
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/introduction-quickstart.php#define-a-model)
###### 3.4 Create a Model
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/introduction-quickstart.php#create-a-model)
###### 3.5 Grant Permission
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/introduction-quickstart.php#grant-permission)
###### 3.6 Check Permission
[Snippet](https://github.com/evansims/openfga-php/blob/main/../../examples/snippets/introduction-quickstart.php#check-permission)
##### 4. **Run the Example**
1. Make sure your OpenFGA server is running
2. Save the code as `example.php`
3. Run `php example.php`
<!-- End of evansims/openfga-php/docs/Getting Started/Introduction.md -->
<!-- Source: evansims/openfga-php/docs/README.md -->
<div align="center">
<p><a href="https://openfga.dev"><img src="https://raw.githubusercontent.com/evansims/openfga-php/main/.github/openfga.png" width="100" /></a></p>
<h1>OpenFGA PHP SDK</h1>
<p>Stop writing authorization logic. Start asking questions.</p>
<p><code>composer require evansims/openfga-php</code></p>
</div>
<p><br /></p>
### Getting Started
Build your authorization integration
- [Introduction](https://github.com/evansims/openfga-php/blob/main/Getting Started/Introduction.md)<br />
Start here to get your first authorization check working.
- [Installation](https://github.com/evansims/openfga-php/blob/main/Getting Started/Installation.md)<br />
Install the SDK and set up required dependencies for your environment.
- [Authentication](https://github.com/evansims/openfga-php/blob/main/Getting Started/Authentication.md)<br />
Set up authentication for production environments and managed services.
### Essentials
Learn the core concepts and patterns
- [Stores](https://github.com/evansims/openfga-php/blob/main/Essentials/Stores.md)<br />
Manage authorization stores for multi-tenant applications and environment separation.
- [Authorization Models](https://github.com/evansims/openfga-php/blob/main/Essentials/Models.md)<br />
Learn how to define your permission rules using OpenFGA's intuitive DSL.
- [Relationship Tuples](https://github.com/evansims/openfga-php/blob/main/Essentials/Tuples.md)<br />
Understand how to grant and revoke specific permissions between users and resources.
- [Permission Queries](https://github.com/evansims/openfga-php/blob/main/Essentials/Queries.md)<br />
Master the four types of queries: check permissions, list objects, find users, and expand relationships.
- [Assertions](https://github.com/evansims/openfga-php/blob/main/Essentials/Assertions.md)<br />
Define test cases to verify your authorization model.
### Features
Explore advanced features and patterns
- [Helper Functions](https://github.com/evansims/openfga-php/blob/main/Features/Helpers.md)<br />
Simplify your code with convenient helper functions for common authorization operations.
- [Concurrency](https://github.com/evansims/openfga-php/blob/main/Features/Concurrency.md)<br />
Leveraging the SDK's powerful concurrency features to improve performance when working with large-scale authorization operations.
- [Exceptions](https://github.com/evansims/openfga-php/blob/main/Features/Exceptions.md)<br />
Handling errors and exceptions in your authorization system.
- [Integration](https://github.com/evansims/openfga-php/blob/main/Features/Integration.md)<br />
Integrating OpenFGA with your existing systems and frameworks.
- [Observability](https://github.com/evansims/openfga-php/blob/main/Features/Observability.md)<br />
Essential tracing and metrics to monitor your authorization system, including advanced event-driven telemetry and custom monitoring patterns.
- [Results](https://github.com/evansims/openfga-php/blob/main/Features/Results.md)<br />
Building robust applications with proper response handling using the SDK's Result pattern.
<!-- End of evansims/openfga-php/docs/README.md -->