Re: [Fwd: Re: PEAR framework changes for PHP5]
| From: | Sérgio Carvalho | Date: | Sat, 31 Jan 2004 16:45:25 +0000 |
| Subject: | Re: [Fwd: Re: PEAR framework changes for PHP5] | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25369@lists.php.net to get a copy of this message | ||
Hans Lellelid wrote:
The issues is that current PEAR classes have expectations about where to find files. It would be nice if you could specify not only the name of a custom class, but the location (yes, relative to somewhere on the include path) of the file that contains that class. For example, if I have a web application that lives in /var/www/apps/mywebapp I might have some custom db drivers located at /var/www/apps/mywebapp/classes/mywebapp/db/MysqlCachingDriver.php /var/www/apps/mywebapp/classes/mywebapp/db/PgsqlCachingDriver.php Now, I want users to choose which driver to use in a configuration file. I want to provide the option of having them choose their own drivers also. (...)You can already do that, without introducing more complexity. Most, if not all, PEAR packages refer to include files using relative paths. So, all you need to do is add your include dir ahead of PEAR's: ini_set('include_path',
realpath(dirname(__FILE__) . "/classes") .
(DIRECTORY_SEPARATOR == '/' ? ':' : ';') .
ini_get('include_path'));
Now, if some PEAR class exists in you classes directory, it is preferred over the one in PEAR.
Sérgio