Registry component provides a mechanism for storing data globally in a well managed fashion, helping to prevent global meltdown.

v3.0.0 2020-07-24 17:54 UTC

This package is auto-updated.

Last update: 2024-04-25 02:22:07 UTC


README

Registry component provides a mechanism for storing data globally in a well managed fashion, helping to prevent global meltdown.

Version License Total downloads Quality Score


Installation

With Composer:

composer require flextype-components/registry

Usage

use Flextype\Component\Registry;

$registry = new Registry();

Methods

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.

Method: set()

Set a value in the registry.

Example:

$registry->set('movies.the-thin-red-line.title', 'The Thin Red Line');

Method: get()

Get item from the registry.

Example:

$registry->get('movies.the-thin-red-line.title');

Method: has()

Determine if the registry has a value for the given name.

Example:

if ($registry->has('movies.the-thin-red-line.title')) {
    // do something...
}

Method: delete()

Example:

$registry->delete('movies.the-thin-red-line.title');

Method: flush()

Flush all values from the registry.

Example:

$registry->flush();

Method: all()

Get all values in the register.

Example:

$dump = $registry->all();

License

The MIT License (MIT) Copyright (c) 2020 Sergey Romanenko