Notes on codes, projects and everything

MVC: Kohana vs. Zend Framework

After comparing my own implementation of MVC with CodeIgniter’s, now I’m comparing Kohana’s and Zend’s. I have just shifted from CodeIgniter to Kohana recently in work and is currently learning on how to use Zend Framework to build my web-app. As everybody knows, Zend Framework is more like a collection of library classes than a framework a la Ruby on Rails, using MVC in Zend Framework would require one to begin from bootstrapping stage. However, in Kohana, just like other frameworks, bootstrapping is done by the framework itself so the developer will get an installation that almost just works (after a little bit of configuration).


Basically there is no much difference in the controller, besides the naming convention that one has to follow. However, in Zend Framework, every public action method in the controller will be configured to a view template by default. For example, if you have a controller as follows:

class IndexController extends Zend_Controller {
public function __construct() {
public function indexAction() {
// some code

Even if you choose only to perform one print hello world statement, you will still get an error message indicating that the view is not found, as follows:

Uncaught exception ‘Zend_View_Exception’ with message ‘script ‘index/index.phtml’ not found

Just like what I mentioned above, in Kohana, they don’t even care whether you are using view, I can simply just output from the controller whenever I want.


From the first glance, Kohana and Zend Framework is doing similar things with the View. In Kohana, you can have a view defined with the following code in the controller (or any other place):

// in the controller
// instantiate the view object
$view = new View('path_to_the_filename_without_extension');
// another form
$view = new View;
// yet another form
$view = View::factory('path_to_the_filename_without_extension');
// inject in some values to the view to be manipulated
$view->set('variable_name', 'some value');
// this is also valid
$view->variable_name = 'some value';
// display the view

Most of the time you won’t even need to further subclass the supplied View class. To display content to the browse, you will need a view file (more like a template file). The view file will be something like follows:

<p><?php echo $variable_name; ?></p>

In Zend Framework, the code is almost similar, but I think they have more to offer if you want flexibility.


In Kohana, you have 2 choices, either to use ORM as model or just a model that doesn’t really do anything much by default. I use a variant of IgnitedRecord as model in work, and I just started to question whether ActiveRecord pattern is suitable as a model in MVC few weeks ago. In Zend Framework you get no model at all as you are expected to create one for yourself.


Nothing much to conclude, but through the comparison between 4 different implementations to MVC, I kinda learn a lot. As I have just only started learning MVC these days, I think I will post further notes on MVC in Zend Framework soon.

leave your comment

name is required

email is required

have a blog?

This blog uses scripts to assist and automate comment moderation, and the author of this blog post does not hold responsibility in the content of posted comments. Please note that activities such as flaming, ungrounded accusations as well as spamming will not be entertained.


@Darshana sorry for the late reply, I would suggest going zend if you are looking into more libraries, but if you want to get work done without much work then kohana should be a good choice.

@David Z: I am currently working on my personal project using zend + doctrine, and kohana for company projects. For a community project, I think kohana is doing great job in delivering the documentation by providing a wiki, a learning blog as well as the discussion forum.


Good post. I think Zend is stronger. That’s because Zend has a lot of functionality inside, like PDF generator, native integration with JQuery – Dojo, an IDE called Zend Studio… ya’ know? a lot of things. Kohana is a good framework, I’d love it’s own ORM (Zend has no something so strong like that), altought Zend has it’s ways to work hand by hand with Propel or Doctrine, very powerfull and well known ORMs for PHP….

Zend’s documentation is really bigger than Kohana’s docs…. just like the screencasts, tutorials…. books… etc. Kohana could be a little bit more interesting if there would be some good tutorials to download, or a screencast… or some official documentation to download…

Both frameworks are great. Just find wich one has what you need or which one can adapt to other libraries to make your work a lot easier….

PD: Sorry about my english….

David Z

Many thanks for sharing this post. We’re also in the middle of a stage whether selecting kohanaphp or ZEND Framework.


Click to change color scheme