Registry | Flextype

Registry

Core Concepts

A registry is a container for storing objects and values in the Flextype application space. By storing the value in a registry, the same object is always available throughout Flextype application. This mechanism is an alternative to using global storage.

Methods

Name Description
get() Get item from the registry.
set() Registers or update a given value under a given name.
has() Checks if an object with this name is in the registry.
all() Get all values in the register.
delete() Delete a value from the registry.
flush() Flush all values from the registry.

Methods Details

get()

Get item from the registry.

Examples

Get flextype.settings.timezone item from the registry.

$flextype_timezone = flextype('registry')->get('flextype.settings.timezone');
set()

Registers or update a given value under a given name.

Examples

Set flextype.settings.timezone item in the registry.

flextype('registry')->set('flextype.settings.timezone', 'America/New_York');
has()

Checks if an config item with this key name is in the config.

Examples

Checks if an flextype.settings.timezone item with this key name is in the registry.

if (flextype('registry')->has('flextype.settings.timezone')) {
    // do something...
}
all()

Get all values in the register.

Examples

$registry = flextype('registry')->all();
delete()

Delete a value from the registry.

Examples

flextype('registry')->delete('flextype.settings.timezone');
flush()

Flush all values from the registry.

Examples

flextype('registry')->flush();

On this page

Language: en, ru