[PHP] OO oriented PHP frameworks

2011-01-06 Thread Jerome Covington
I was specifically curious if there are frameworks which use the convention
of passing config objects to functions/methods in the same way that
contemporary JS libraries like jQuery do.

-- 
Regards,
Jerome
jeromecoving...@gmail.com
--
http://www.jeromecovington.com
One Plus the World http://www.jeromecovington.com/one_plus_the_world


Re: [PHP] OO oriented PHP frameworks

2011-01-06 Thread David Harkness
On Thu, Jan 6, 2011 at 12:36 PM, Jerome Covington jeromecoving...@gmail.com
 wrote:

 I was specifically curious if there are frameworks which use the convention
 of passing config objects to functions/methods in the same way that
 contemporary JS libraries like jQuery do.


We use Zend Framework along with its MVC framework. In the Bootstrap class
initialized from index.php we load an INI file into a Zend_Config object
which parses it into a hierarchical array, and store the config in the
Zend_Registry--essentially making it a global variable (Singleton pattern).

Instead of passing it around to the objects that need it, each class
accesses it directly from the registry. While this couples these classes to
the registry, it makes the code simpler. Were I to write it from scratch, I
would have created a helper object that passes the config object to each
controller as it's created, whether it needed it or not. That would make one
class (the helper) dependent on the registry instead of every controller
that accesses the config object.

David