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
OpenFGA\Schemas
- SchemaRegistryInterface (interface)
Implements Schemas\SchemaRegistryInterface
public function create(string $className): SchemaBuilder
Create a new schema builder for the specified class.
Name | Type | Description |
---|---|---|
$className |
string |
The fully qualified class name |
SchemaBuilder
— A new schema builder instance
Implements Schemas\SchemaRegistryInterface
public function get(string $className): ?OpenFGA\Schemas\Schema
Retrieve a registered schema by class name.
Name | Type | Description |
---|---|---|
$className |
string |
The fully qualified class name |
Schema
| null
Implements Schemas\SchemaRegistryInterface
public function register(Schema $schema): void
Register a schema in the registry.
Name | Type | Description |
---|---|---|
$schema |
Schema |
The schema instance to register |
void