KillerPHP Blog

PEAR vs. Zend Framework

March 14, 2008

PEAR vs. Zend Framework

Now that the Zend Framework is ready for ‘prime time’, I’ve been considering the Pear framework with regards to how it now fits in the PHP world.

zend framework logo

NOTE:

Several picky nerds have pointed out that PEAR is not a framework – check out the comments below. OK, I would agree, technically speaking, PEAR is not a framework. That said, this is what the PEAR people say on the home page of their web site:

‘PEAR is a framework and distribution system for reusable PHP components. You can find help using PEAR packages in the online manual and the FAQ.’

Anyway, that is an argument of semantics and nerd-details … not the point of my article.

… Back to my article:


Both Zend and Pear are frameworks but how are they different?

I would say that the Zend Framework attempts to create a comprehensive whole – a consistent set of components that are designed to work together in a unified manner.

… That is one of the reasons for a framework in the first place.

Though unified, one of the cool things about the Zend Framework is that you can just pick and choose what components you want to use – you don’t have to buy the whole cake to take advantage of all that juicy object oriented PHP code.

About PEAR:
pear-framework-logo

With the Pear framework, it is more of a hodgepodge/motley of assorted components. Pear is widely used (and useful) but it does cross over (in terms of functionality) with what we have in the Zend Framework. So the question that comes to my mind is:

Do we still use Pear, if we have the Zend Framework?

The simple answer is found in the version of PHP you are using:

If you are using PHP 4, you will have to use PEAR since the Zend Framework depends on PHP 5. Remember that PEAR does predate the Zend Framework.

And on the flip side, if you are using PHP 5, you might as well favor the Zend Framework since it is a comprehensive unified framework.

While considering this question (PEAR vs. ZEND Framework) I struck up a conversation with Jonathan about this … I thought it was worth including here:

Hi,

I was wondering what you thought about Pear given that Zend is out?

… Is there cross over or does Zend leverage Pear?

Thanks,

Stefan

Jonathan Lebensold wrote:

From what I’ve seen there’s no dependency with Pear in Zend. Although Zend appears to be a higher-level functional replacement for Pear. (Pear kinda sat between what you would expect php to provide you in extensions and what would facilitate a developer in writing applications. That distinction is now made through extensions / PECL (C libraries) and Zend)

J.

From what I can see, if you are using PHP5, Pear is no longer needed because of Zend – would you agree?

Stefan

Jonathan Lebensold wrote:

I think that pear will be deprecated since it was unreliably deployed on webhosts (which led people to dumping instances of the whole PEAR framework into their applications.. mind you that’s what people are doing with ZEND).

I would say that PEAR is on the downward slope, but a lot of legacy code depended on it (especially from PHP4 era). newer applications should look towards independent classes (like the ones at phpclasses.org) or solutions provided in frameworks (like smarty / zend / cake / etc…)

j


Conclusion:

We’ve developed a couple of Web 2.0 applications with beta versions of the Zend Framework and I think we made a good choice:

… Even with that early version of the framework, we found it to be very useful and worth implementing.

Another bright spot, was that we got new developers productive with the Zend Framework rather quickly. A nice change from what I had to deal with during my Java days! Did I say Web Objects sucks?

:)

Anyway, I’m excited to explore the latest releases of the Zend Framework and to write more about it as time permits.

Thanks for reading,

Stefan Mischook