You mean the Singleton s registry, right? If so, it looks like all you really need is access to three global objects everywhere, but contained inside another object.
So, if you wrote cache.php, sessions.php, and database.php files that define the Cache , Sessions and Database classes, you want to contain them all inside the Registry object defined in registry.php.
First of all, it's great to control ORDER instantiations in this way. This is better than just doing require_once cache.php, sessions.php and database.php, and inside them you define not only a class, but also one global instance. This controls the instance ORDER by the way you include / require it. The look is sleazy. It is better to have your own registry object, which, when it is created and becomes a global $registry , the first thing is to control the creation of your global symbols in the order and how you want.
Secondly, it is great to have one Registry.php, which has one global registry $. Defining global variables here and there from various files is difficult.
Now that I have agreed with you, I ask you an important question. As you can see, they are different:
$registry->getObject('session'); $registry->getObject('database'); $registry->getObject('cache');
vs
$registry->getSession (); $registry->getDatabase (); $registry->getCache ();
Personally, I like the latter. You do not use the string "session" to refer to the Session object obtained through the super-generic getObject . Instead, you use getSession() to get the session. He reads better.
Your registry, in the end, knows everything about the three global steps, it creates them explicitly, so it is already locked for one purpose. Adding specific methods, also related to its sole purpose, is not “weak” or “bad”. Instead, I think it's less code and easier on eyeballs.