API Schemas SchemaRegistry - evansims/openfga-php GitHub Wiki

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.

Table of Contents


Namespace

OpenFGA\Schemas


Source

View source code


Implements


Related Classes


Methods

create

Implements Schemas\SchemaRegistryInterface

public function create(string $className): SchemaBuilder

Create a new schema builder for the specified class.

View source


Parameters

Name Type Description
$className string The fully qualified class name

Returns

SchemaBuilder — A new schema builder instance


get

Implements Schemas\SchemaRegistryInterface

public function get(string $className): ?OpenFGA\Schemas\Schema

Retrieve a registered schema by class name.

View source


Parameters

Name Type Description
$className string The fully qualified class name

Returns

Schema | null


register

Implements Schemas\SchemaRegistryInterface

public function register(Schema $schema): void

Register a schema in the registry.

View source


Parameters

Name Type Description
$schema Schema The schema instance to register

Returns

void

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