Re: [pear-webmaster] PEAR and PEAR2
| From: | Brett Bieber | Date: | Sat, 26 Mar 2011 16:21:55 +0000 |
| Subject: | Re: [pear-webmaster] PEAR and PEAR2 | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-31045@lists.php.net to get a copy of this message | ||
On Thu, Mar 24, 2011 at 4:24 AM, Raffael Vogler
<raffaeluni@googlemail.com> wrote:
>
> Hello!
>
> I am unable to make head or tail of what is actually the difference between
> PEAR and PEAR2 and why there are two separate websites. I also had a close
> look at the manual but couldn't find anything decent to clarify that
> question. Well, PEAR2 is obviously newer than PEAR and probably preferrable
> and 'supports' the new features of PHP 5.3, but what does that really mean?
> Of course I can use 5.3 stuff also in a PEAR package ... please help!
First of all, the PEAR repository and PEAR installer are two separate things.
PEAR2 is the next generation of the PEAR repository, Pyrus is the next
generation of the PEAR installer.
The PEAR repository has a set of standards for all packages released
there. Likewise, the PEAR2 repository has standards each package must
conform to. Unfortunately wiki.php.net which has all the details is
down at the moment, but here's the basic differences between PEAR
standards and PEAR2 standards.
- PEAR2 packages are PHP 5.3+ only
- All code is under the PEAR2 namespace
- Each package must use package.xml v2.0
- Files autoload with PSR-0 autoloader
- require_once is not allowed
- Packages should not be tied to the filesystem they're installed to
- New versioning standards allow breaking BC without renaming the package
- Packages should extend SPL Exceptions, and implement a base
Exception interface
Pyrus, the new installer, is actually a self-contained phar archive
and requires no complex installation. The new installer supports many
features that improve upon the original PEAR installer, and can
install existing pear packages from pear.php.net, pear2.php.net, and
other pear-compatible channels.
The code within the pyrus.phar file complies with the PEAR2 coding
standards, and therefore is in the PEAR2 repository and can be
installed if you'd like to use it as a vendor library.
With the pear installer you would use pear install pear/Net_URL2
With pyrus, php pyrus.phar install pear/Net_URL2
When you install a package which conforms to the PEAR2 standards, you
can safely move it to another location, commit to a repository, and
the installs aren't tied to a specific machine. This makes it much
easier to create a vendor directory containing libraries your
application needs and share this with others.
There's quite a bit more, but that's the basics of PEAR2 and Pyrus.
--
Brett Bieber