Re: PEAR2 standards, we would like to know what you think

From: Date: Tue, 10 Jul 2007 12:26:23 +0000
Subject: Re: PEAR2 standards, we would like to know what you think
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-47374@lists.php.net to get a copy of this message
Hi, Christian Weiske wrote:
It is very important that you comment as these standards will define PEAR2. RFC at: http://wiki.pear.php.net/index.php/PEAR2_Standards
To fully understand which problems PEAR2 is trying to solve (and how), please read http://wiki.pear.php.net/index.php/Pear2_require
Some comments
    *  Quite a few people do not like to install a full installation program on their server just to be able to use one or two packages from PEAR
And that's why current PEAR installer has remote installation mode: http://pear.php.net/manual/en/installation.shared.php
    * PEAR installations are not relocatable. If you move PEAR's installation directory (containing php, data and such), chances are high that the code won't work anymore because of install-time file replacement tasks.
That's a genuine problem.
    * PEAR currently uses require_once in nearly each file to include dependencies. This works fine, but is too slow for high-traffic pages for two reasons:
          o require_once needs to traverse the whole include path until it found the correct file. This leads to at least doubled disk usage when searching for the files compared to the single access that is needed if you specify the full path.
          o Checking if the file has been included only once is expensive 
That's a genuine problem.
    * A common problem when beginning with PEAR is setting up include path which is required for pear to work at all. 
IMO, if a person is unable to set up include_path, then we must encourage him not to use PEAR. ;]
Unzip and go
I think that "unzip-and-go" is an Extremely Bad Idea. We'll be overwhelmed with bogus bug reports from people who are unable to resolve their dependencies manually. These, by the way, will be the same people who are unable to set up their include_path. Now that I have a better understanding of what we are trying to achieve, I'd like to present a solution that looks better to me: * Create a PEAR2_Loader class that'll take care of loading files / classes * Disallow direct inclusion of files in packages via include[_once] / require[_once] * All inclusions should go through PEAR2_Loader::loadClass('classname'); or PEAR2_Loader::loadFile('filename'); * PEAR2_Loader will also provide an __autoload() implementation for PEAR2 classes. * PEAR2_Loader may be configured to use include_path / not use include_path / make loadClass() a no-op (if called from hypothetical allfiles.php) * Instead of directly using an allfiles.php, PEAR2_Loader may have a loadPackage() convenience method.

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