Basic implementation of registry pattern that implement a central storage for objects often used throughout the application.
via Composer:
"require": {
"clean/registry": "*"
}
$registry = new Registry()
$registry->set('var1', 1);
$var1 = $registry->get('var1');
if ($registry->has('var1')) {
...
}
or you can extend any class with ReigistryTrait
to add registry methods to it
class MyClass {
use \Clean\Registry\RegistryTrait;
}