Code and Coffee


PHP Frameworks

Posted on July 12, 2006, under Development.

Every time I start a new web project, I have to ask myself the one question that developers have to answer all the time. “Do I reinvent the wheel?” Frameworks have become a major player in online development, they carry lots of benefits in helping you efficiently writing applications and doing so quickly. Frameworks can also help you with scaling issues. If your application or service grows in users, frameworks can sometimes help you with that load. And no one can forget AJAX, some frameworks even have built in support to allow you to easily include spiffy AJAX effects into your application.

I for one, have yet to use a framework in a real world application and this has been out of choice. My main reason for never implementing a framework is because it most of my cases it would be an overkill. None of my applications would see 1/4 the benefits of using a framework. In addition, like most developers, I suffer from the “wanting to build it myself” gene. Even if it is already written by someone else, and even if it would make my life a lot easier; I still want to create it myself. Why? To see if I can do it. In addition, a lot of the frameworks out there are open source and development on them is moving along really fast right now. It is great to see innovation come that fast, it is definitely something that the commercial software industry can’t compete with. However, this might deter some developers because they now have to stay on top of the development and update their framework with bug fixes and new features. Additionally the more popular that framework becomes, the more exploits thee might be.

On the flip side, frameworks help your application more than you know. If you have a series of functions a design patterns from the beginning, and those are solid and well written, it will help you continue that path with the rest of the code you write. Later on I talk about code I wrote, and how frameworks made me look back and see there were a lot of things I could have done better with that code. Frameworks give you a good foundation, that the rest of your site will follow.
With all of that said, frameworks are still a cool thing and I have been playing with one for a couple months. CakePHP is a free open source PHP framework. When choosing a framework to study and test out, a lot of the ones I tried suffered from some of the problems stated above. CakePHP on the other hand did not. It takes the cake for PHP frameworks. (sorry) Even if you are not interested in PHP frameworks; you have to check out their website, it is a very well designed and laid out site with kind of a retro spin on it.

So CakePHP was a breeze to setup, it took five minutes maybe ten because I was a newbie and following instructions to a T. Next I thought, OK now I have to learn how to use this; when actually it wasn’t as hard as I thought it would be. I decided to make a test application, I figured this would be a real life scenario for myself and would allow me to cover all of the basics: forms, databases, and recurring functions. CakePHP was amazing in all of those aspects and more. I am still learning new functionality with CakePHP.
In the past I have always had a series of PHP files that I use in different web applications. Ones I wrote years ago that work, and work to my liking. CakePHP has definitely taken me outside of my comfort zone, but has done so in a good way allowing me to see better ways of accomplishing things. I will be continuing to follow development on CakePHP and other frameworks. For now I am starting to integrate CakePHP into one of my bigger web applications to see what it will do in a real world scenario for me.

Popularity: 7% [?]



7 Replies to "PHP Frameworks"

gravatar

Maciek Kuś  on July 14, 2006

You should take a look at CodeIgniter - quite interesting alternative to CakePHP - http://codeigniter.com

gravatar

mattrmiller  on July 14, 2006

I have seen this before, and have in my bookmarks of things to checkout. I will have to make this a priority, that video about crating a blog in 20 minutes is pretty cool.

Thanks!

gravatar

Kevin  on July 15, 2006

My company just finished a review of the top frameworks, including codeigniter and cakephp. codeigniter was by far the easiest to use, but also the most feature incomplete, so maybe it will be ready in 6-12 months. cakephp was barely acceptable (I didn’t review this one) and paled in ease of use with codeigniter. In the end we decided to stick with our own homegrown, rough around the edges framework.

gravatar

Tal Ater  on July 17, 2006

I’ve used both CakePHP and Symfony (http://www.symfony-project.com/) in production.

I’ve found that Cake simply tries to emulate Rails 1:1, and doesn’t really does it’s own thing… And ofcourse it doesn’t do Rails as well as Rails does.

Symfony on the other hand, took a much larger time investement to get started, but I’ve found the rewards in using it to be worth the while.

I am now working with Symfony, and plan to use it for my next projects as well.

gravatar

mattrmiller  on July 17, 2006

That looks really nice, the only thing is it’s PHP 5 which a lot of hosts still do not support for some reason. I am still trying to get in on my server, but it doesn’t play nice with other software like Plesk. Until Plesk supports it, I can’t use it :(

gravatar

Chui  on July 25, 2006

I spent a day working with CodeIgniter.

The framework is pretty mature, and easy to navigate.

The include loader is a bit strange, but once you get used to it, it’s fine.

Then there is the case of $obj =& get_instance(). You will need it, when models load models.

There are some quirkiness with database queries, for instance
$this->db->query() is seems to behave like a result set…, except it also has methods like first_row, and results. A bit counterintuitive there, but luckily there are lots of examples, if you judiciously use the search feature on the documentation pages.