API Models TypeDefinitionInterface - evansims/openfga-php GitHub Wiki

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.

Table of Contents


Namespace

OpenFGA\Models


Source

View source code


Implements


Related Classes


Methods

getMetadata

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


Returns

MetadataInterface | null — The metadata, or null if not specified


getRelations

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


Returns

TypeDefinitionRelationsInterface | null


getType

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


Returns

string — The unique type name


jsonSerialize

public function jsonSerialize(): array<string, mixed>

View source


Returns

array&lt;string, mixed&gt;

⚠️ **GitHub.com Fallback** ⚠️