Monthly Archives: October 2010

Why to use Zend Framework?

Why you should use Zend Framework. Here are some benefits, which motivates web programmers to use it 🙂

Zend Framework is a fully object-oriented framework. So there are a lot of classes and interfaces which can be extended and implemented.

Based on MVC Architecture and consist of collection of class and components. Big library of components and ability to integrate new ones or customised existing. Because of loose coupling it is very easy to do customisation and integration of components.

Integration with ORM (i.e Doctrine) makes it more powerful. It is very easy to integrate other frameworks and templating engines such as JQuery, Smarty.

Zend Framework makes it easy to do TDD via Zend_Test, which uses PHPUnit, a popular unit testing framework. PHPUnit lets you test not only your Controllers, but also your library and model functions.

Because of its multiple components, complexity, and fully object-oriented approach, Zend Framework has a very steep learning curve. It becomes easier to learn due to the comprehensiveness of its documentation and community.

Difference between Zend_debug and Zend_log

Zend_Debug is a very simple component that provides a quick way to dump variables to screen for ad-hoc debugging.

Zend_Debug::dump($_Server, 'SERVER VARS', true);

Above command will dump out the $_server array with the label SERVER VARS

Zend_Log
Zend_Debug is very good for ad hoc debugging. For more permanent debugging, we can use Zend_Log. Zend_Log has some greate features, including Firefox Firebug stream writer that enables us to log to the Firebug console.
$log = new Zend_Log(
new Zend_Log_Writer_Stream('php://output')
);

Multiple loggers and the ability to define your own events and log levels are also included in its features.