Yii Framework vs Zend framework 2

Zend Framework and Yii Framework are object oriented web application frameworks written in PHP. Over the recent years Yii has become extremely popular with the developers for implementing large scale secure and fast web applications, better to say, has become number 1 choice for many of them. However with the long-awaited release of Zend Framework 2 (ZF2) that supports all great PHP 5.4 features the position of Yii may suffer:)

So let’s start with the “newborn” Zend Framework 2. In no way it can’t be compared with the older ZF versions as ZF has been totally rewritten. More than 5 years have passed since ZF 1.0.0 release! Zend framework 2 includes almost all the advance PHP features which have taken the framework to the next level.

Some of the great features:

Modular Approach. Zend Framework 2.0 introduces a new and powerful approach to modules. This new module system is designed with flexibility, simplicity, and re-usability in mind. ZF2 emphasize on dividing your application logic into several modules rather than controllers. Each module in ZF2 application acts as a separate application with its own configuration and layout. Application module will be loaded every time so the default stuff goes into the application module. A module may contain just about anything: PHP code, including MVC functionality; library code; view scripts; and/or public assets such as images, CSS, and JavaScript. The possibilities are endless. Such an extensive modular approach not only improves the performance of application but also make it easy to manage and debug.
Service Manager. It`s one of the best features of ZF2. Service manager is simply a layer which will return you the object of any service you want to use in your application with the flexibility to include your own factories.
Event Manager. The basic architecture allows you to attach and detach listeners to named events, both on a per-instance basis as well as via shared collections; trigger events; and interrupt execution of listeners.
PHP Composer. Another great addition in the ZF2 which will automatically get the dependences of the project groom is the PHP composer. Composer makes sure that every project is using the same libraries with same versions.

ZF2 minuses.

Some developers may call it over engineered as the learning curve of the framework is quite hard. Also documentation is currently the weakest part of ZF2: Zend has followed its tradition of bad documentation. However the Zend skeleton application tutorial may provide you with some info about the framework.

And now let`s move to YiiJ Yii is a component-based high-performance PHP framework for developing large-scale web applications. We have already had a couple of articles in our blog dedicated to this frameworkJ To cut the story short , Yii is very fast and flexible and has many pluses and great features. Here are some of them

Integration with Javascript framework jQuery. Yii library comes with all the jQuery extensions like tabs and datepicker, allowing you to use jquery extensions in a very PHP way and initialize them on server so you can control their behavior on the client side in efficient way.
Yii Community. It is very vibrant and active and its participants can render great assistance to every developer.
Gii Module. Yii has handy built-in code generator Gii. With its help it`s possible to create web 2.0 applications in minutes. Basically this module allows you to create a model from your database table and then can from that model you can create the CRUD operations.
Active Record. One of the pluses is comfortable work with database: it can be used either as Data Access Objects, or as Active Record

Yii minuses:

Among the downsides of the framework many developers name a quite tough learning curve. Besides while using YIi developers need to be very careful about what you are dealing with, if you can do it well you are good to go.

Have you already tried to work with Zend Framework 2? Would you prefer ZF2 or Yii for your projects? Interesting to know your thoughts.

Anna Kozik

Business Development Manager

%d bloggers like this: