Tag Archives: Kohana

What Are the Advantages of a PHP Framework?

CodeIgniter. CakePHP. Kohana.

There’s no shortage of PHP frameworks…but why should you use one? What are the major advantages?

  • MVC – The Model-View-Controller architectural pattern helps you tier your code for easier maintenance. By keeping the data-manipulating logic separate from the bits that handle the display, you make it much easier to change either the template or the underlying code without touching the other.
  • Bundled classes – A framework includes classes and helper functions for common tasks, such as database access, pagination, and form handling. Not to mention smaller things, like truncating text to a specific word/character count.
  • Rapid development – Frameworks help you create a small to medium-sized application much quicker than if you wrote everything from scratch. If you’re in a hurry, using a framework will help you finish things before you reach that looming deadline.

If you’re a total DIY type, you don’t even need to rely on a third-party PHP framework. You could assemble on yourself, one that’s more specific to the projects you work on.

Kohana: Cleaner CodeIgniter For PHP 5

KohanaOne of the major criticisms of the CodeIgniter PHP framework is its continued support for PHP 4. The developers of the language announced two years ago that PHP 4 development, security patches included, would cease by the end of 2007. The CodeIgniter project still insists on supporting the outmoded PHP version, because far too many shared hosting providers still haven’t upgraded their machines for fear of breaking peoples’ poorly-coded scripts.

While CodeIgniter’s legacy support doesn’t stop you from using PHP 5-specific features in your applications, it does make things a bit less…elegant. If you’re going to build a sports car, would you put an old, less-efficient engine inside it?

Enter Kohana, “the swift PHP framework.”

Kohana is a fork of CodeIgniter, but entirely rewritten to be strict PHP 5 OOP. There are some different conventions, but overall the frameworks are similar enough that migrating is relatively painless. I’m still reading through the documentation, but it seems like it’s definitely worth looking into. Some of you may prefer CodeIgniter for their larger community, but it you’re a developer who has ever been frustrated by CodeIgniter’s decision, then you definitely want to have a look at Kohana.