We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon\Registry()

if i have something like this in my front controller:

$registry = new \Phalcon\Registry(); $registry->body = file_get_contents('php://input');

how can i use $registry all over my application ?

edited Mar '14

You have to register Registry in DI container

 $di->set('registry', function(){
  return new Phalcon\Registry();
 }, true);

then you can use it everywhere

 $this->registry->testKey = "testValue";


901

What is the point of using registry pattern via pretty similar DI pattern? Isn't it better to implement registry as classic singleton?