Why Choose Kohana?
It’s no secret that I’ve been struggling with Kohana over the past few weeks as I’ve been building a new site for a non-profit in Vancouver, BC.
You may want to read my web development background for more information about my development path and how I got to this current project.
Although I’ve been programming in PHP for a decade or so I’ve learned the limitations of the language and started building up a reportoire of code modules and drop-in classes. The first one I wrote was an error handler as v4 was hopeless. My class would intercept the errors, log them, show them in development but not production, and would even dump the source around the problematic line.
My second class was a database abstraction class that integrated to the error handler but handled all of my SQL queries, integrating XSS filtering, profiling of the queries and made the cumbersome PHP language constructs more intuitive. For example, pulling a whole result set back as an array.
These two classes became key ingredients in my projects and then I started looking at other classes. Maybe I should use a routing class so I can use SEO-friendly URLs. The concept of MVC appealed. I already had a templating class and I’d already started splitting my code into modules for each subdirectory of my site.
I also wrote a form handling class; one that would construct the forms, pre-populate the fields, validate the results and also highlight any errors in a user-friendly manner.
I then wanted to add session management into the mix, create object-based relationships in my database for ultimate flexibility and I started to outline my own framework.
It was around this time that I learned the word framework and started looking at every PHP framework for one that suited my needs. I’d looked at Joomla!, Drupal and every other CMS but didn’t like the learning curve or the rigid approach to development they enforced. I even bought books on Joomla! and Drupal to help me learn how to use them but I never got on with these systems.
It seemed that I knew more PHP than I needed to know to make them work and my more advanced knowledge of PHP gave me issues as I wasn’t prepared to curb my knowledge to fit in with their systems.
So I went back to the frameworks and found CodeIgniter. I felt at home. It had almost everything that I wanted with minimal bloat and would replace every piece of home-grown code I’d made. All I needed now was a design project.
It took a while. In fact it was nearly a year and then this non-profit request came through. And then I heard about Kohana.
So I downloaded both frameworks and started playing around. PHP v5 does have some neat features, particularly around classes and error handling so I decided to use Kohana.
The code was well-documented, the community was there and there was some documentation. I’m sure it would have been easier to use CodeIgniter as the documentation and support is superb but I feel Kohana is the future. I also like that I’ve had to update to PHP v5 because it was time to leave v4.3 behind.