Registry component provides a mechanism for storing data globally in a well managed fashion, helping to prevent global meltdown.
With Composer:
composer require flextype-components/registry
use Flextype\Component\Registry;
$registry = new Registry();| Method | Description |
|---|---|
set() |
Set a value in the registry. |
get() |
Get item from the registry. |
has() |
Determine if the registry has a value for the given name. |
delete() |
Delete a value from the registry. |
flush() |
Flush all values from the registry. |
all() |
Get all values in the register. |
Set a value in the registry.
Example:
$registry->set('movies.the-thin-red-line.title', 'The Thin Red Line');Get item from the registry.
Example:
$registry->get('movies.the-thin-red-line.title');Determine if the registry has a value for the given name.
Example:
if ($registry->has('movies.the-thin-red-line.title')) {
// do something...
}Example:
$registry->delete('movies.the-thin-red-line.title');Flush all values from the registry.
Example:
$registry->flush();Get all values in the register.
Example:
$dump = $registry->all();The MIT License (MIT) Copyright (c) 2020 Sergey Romanenko