Re: autoload, include_once naming conventions

From: Date: Wed, 16 Mar 2005 22:01:25 +0000
Subject: Re: autoload, include_once naming conventions
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36710@lists.php.net to get a copy of this message
Stephan Schmidt wrote:
It would be nice to be able to pass a second parameter that defines the 'type' of the class. In several of my projects, I'm using code like: Factory::addClassLocation('Component', '/path/to/custom/components'); Factory::addClassLocation('Component', '/another/path'); Factory::addClassLocation('Filter', '/path/to/custom/filter'); Factory::loadClass('Component_Foo', 'Component'); The class loader then will check, whether the class exists in the custom folder and if it's not found, it checks in the default location. This is nice of you are writing custom drivers for any PEAR class. If this class then uses the class loading mechanism, the user is able to add new paths for the classes.
just a note: generally however I dont want to take away the power of include_path though. its very nice way for the user to stick an include_path infront of the pear path to easily override code from pear. regards, Lukas

« previous php.pear.dev (#36710) next »