Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between PEAR and PEAR2?

Tags:

php

pear

pyrus

So there is the old pear installer and pyrus which is the new package manager for PEAR ... or was it PEAR2 ... at least it's faster and stuff.

And there is the old package.xml version <2.0 and the new package.xml >=2.0 ... is that version related to the package manager ... the pear installer or pyrus?

And what is PEAR2 actually? Why is there http://pear2.php.net/ and there is a version-agnostic 'PEAR' all over the site? Is it actually the same?

Could someone please explain to me how PEAR / PEAR2 / package.xml < and >= 2.0 / pear installer / Pyrus(.phar) are interrelated?

EDIT 1:

Pyrus: Improvements from the PEAR Installer

Basically states Pyrus is better than the old pear installer.

Pyrus no longer supports package.xml version 1.0

So what's going on with anything > 1.0?

In addition, Pyrus has introduced support for PEAR2 packages that can be extracted to disk and then later upgraded using Pyrus.

I'm sorry ... but is that propper English or is it just phrased confusingly? It seems to say that Pyrus also still supports PEAR ... and of course PEAR2. Still leaving the main question to be answered - what is PEAR2?

EDIT 2:

PEAR2 & Pyrus - The look ahead

It's a 2 years old outlook and slides for a presentation ... so mostly just keywords and -phrases.

So PEAR2 is a concept overhaul ... in which way?

Has a new installer ... Pyrus? ... but didn't the other source state that Pyrus has introduced support for PEAR2?

The constraints for package distribution seem to have changed ... only stable and PHPUnit coverage of at least 50% ...

The rest doesn't convey a clear meaning to me.

like image 284
Raffael Avatar asked Mar 23 '11 17:03

Raffael


1 Answers

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.

like image 74
saltybeagle Avatar answered Sep 24 '22 05:09

saltybeagle