Core registry is used to store global variable. You can store global variables via
register() method and fetch value of variables via
In Magento 1, it was possible to register a global variable with the static registry method.
Mage::register('some_var', 'some value');
Many extensions, include core Magento extensions, ended up using this from controller action methods to pass variables into the views.
While its future is uncertain (not marked explicitly supported via an @api, but not marked @deprecated) Magento 2 does have a similar registry object that should help easy the transition for extensions. The class is
Magento\Framework\Registry, and you can inject it in any constructor.
public function __construct(
$this->registry = $registry;
and then set variables with
$this->registry->register('test_var', 'this is a test!');
and fetch those variables back (even from a different object –
Magento\Framework\Registry is a