
I thought I would share with you my experience of PHP frameworks, and in particular a framework called CodeIgniter which I have been using a lot recently. A PHP framework is a platform which enables developers to quickly build web applications without having to re-invent the wheel every time they want to, for example, insert data securely in to a database. This article looks at CodeIgniter (http://codeigniter.com), an open-source PHP framework which in my opinion is fantastic.
The need for a framework
I am an English web developer who has been in the business for over 10 years. I started my business when I was just 17 and started coding in PHP when I was 21. I built my first PHP web application, which was a search engine for musicians, completely from scratch in 2003. It has since become a major success and I still proud of it, though when I look at the code I would love to re-build it knowing what I know today.
After working for many clients and after looking to try to develop my own ideas I soon realised that I was spending a lot of time re-producing the same code snippets on different sites. For example, by 2004-2005 I had written my own database interaction class as well as other functions which made life a lot easier when building websites, for example a function that formatted dates nicely.
This effectively was my own framework, but it suffered from not being very well organised and not very efficient. What I really needed was a tidy way of structuring my code, for example being able to separate my database interaction files from my view files which just dealt with logic (if statements) and the HTML. I had to wait a few years for the right solution.
Making those little ideas become a reality
I often get ideas for websites, some crazy and some simple. Most of them got written down and forgotten about because of the time required to build the ideas in to fully functioning websites. That was all until I discovered CodeIgniter in 2008. CodeIgniter in their own words: “is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks.”
In other words it’s a solution that provides most of, if not all of the tools you need to build your ideas in to websites. After downloading CodeIgniter, looking at their demo tutorials and actually having a play with it myself, I was very impressed indeed and realised I could make my ideas become a reality in very little time.
What about the other frameworks?
Before I jump in to my own opinions about how wonderful CodeIgniter is, let’s take a moment to explore the other frameworks out there. I am aware that there will be developers reading this who do not share my views and believe that the framework they use is best for them. I need to just point out that my findings and experiences of the different PHP frameworks have lead me to believe that CodeIgniter is best for me in my situation, but might not necessarily be the best for you in your situation.
Other PHP frameworks I have come across are:
Symfony is a very powerful framework with functions for practically everything. I worked at an agency that used this framework and though I delved into it a little bit, I never fully could understand it (also the manual for Symfony was very big and heavy!). However it was just right for the website that it powered and I know that a lot of big and well known websites use Symfony. Symfony isn’t that easy to install and does have a steep learning curve.
CakePHP, as far as I’m aware is very similar to CodeIgniter, so is easy to install and well documented. I have to say I haven’t tried CakePHP but would recommend you look also at this open-source framework as well as CodeIgniter if you want to make some comparisons between the two.
Zend in their own words, “is based on simplicity, object-oriented best practices, corporate friendly licensing, and a rigorously tested agile codebase”. Zend is rather complicated and expects you to know quite a bit about coding, so is perfect for people who understood the previous sentence. Howerful Zend is also very powerful, widely used and supported by a large community.
Take also a look at this post: Best PHP Frameworks to build quickly complex web applications
Designers who are also developers
I don’t claim to be a hardcore PHP programmer and know plenty of programmers who are total experts in PHP. I would say that I’m more of a designer who became a developer. As a result of that I sometimes struggle trying to understand something like Zend or Symfony, as you found out above. What I needed was a framework that really explained everything clearly to me, was built specifically for people like me but also had a large community of users in the same boat as me.
I found CodeIgniter had all of these things. The minute I first landed on their website I knew that they had designed their framework with people like me in mind. After downloading and playing with CodeIgniter on my local machine I began to read their documentation and was worried that was where it would all end, but instead I found the documentation on their website really easy to understand and very clearly laid out.
I had soon built an idea that had been running around in my head in to a fully functional website, with user login, avatar upload, questions and answers submission and a very basic CMS. I built that entire website in a weekend, thanks to CodeIgniter. Every time I got stuck I simply searched the community forums, or asked a question and got a response very quickly, and that was only when I couldn’t find the answer I was looking for in the documentation, which was quite a rare occurence.
Tidy code makes all the difference
Tidy code, but also code you can re-use makes all the difference. CodeIgniter uses something called “MVC” which stands for “Model – View – Controller”. The idea behind this is you can separate your database functions (”model”), from your view files which contain your HTML (”view”), and link the two together (”controller”).
By using this practice your code is tidy and re-usable. For example, when building my questions & answers website I could simply just copy and paste the database call which selected all my users, rename the table name in a single line of code, then I would instantly have another function which selected all the questions. By using their “Active Record” class, you can easily put a ‘where statement’ in which only selects records from a certain category, for example.
After building one of my ideas in an entire website in just 3 days, I quickly found my dusty book of other old ideas and realised I could build these in to websites in very little time. How exciting!
Just have fun!
I suggest you download CodeIgniter, install it and have a play. Even if you don’t know much about PHP or programming I can guarantee that you will soon pick up enough of the basics that you will have a basic blog up and running in very little time, providing you follow their tutorials and documentation carefully.
Who knows, you might even end up putting your PHP developer that you hire in at a very expensive rate out of a job! Then again, if we all stick to what we are really good at doing, maybe not – but you can still have a lot of fun trying!
by
Stu is a passionate web developer who loves building web apps in his spare time and following what's new in the web world. Stu focuses mainly on jQuery, PHP, User-Centered Design and Branding. Stu is now looking to extend his business to build and develop his own web applications that he's been working on over the years.


November 17, 2009 at 12:56 pm
nice insights, keep up the good work!
November 17, 2009 at 1:38 pm
Excellent post Stu – I, as well, am a huge CodeIgniter fan. :)
November 17, 2009 at 3:26 pm
Hey Michael – nice to see you on here :-)
Thanks all.
November 17, 2009 at 2:01 pm
Great post!
My favorite framework is also CodeIgniter, apart from my own framework of course.
November 17, 2009 at 2:12 pm
Great article!
I love CodeIgniter! ^^
November 17, 2009 at 2:13 pm
Thanks for the post Stu!
November 17, 2009 at 2:13 pm
Nice timing, I stumbled upon some free time recently and decided to crack open CodeIgniter once again and see if I can’t learn something. This post gave me that little extra encouragement I needed to realize I made the right decision.
November 17, 2009 at 3:12 pm
Why not Kohana on the list?
The swift one for php5.
:-)
November 17, 2009 at 6:34 pm
Agreed, great timing. I’ve been looking into using codeIgniter for my final university project where i’ve basically got 4 months to come up with something akin to flickr (upload images, comment, add friends etc) and wondered if codeIgniter could help.
Now i know what i’ll be looking into this weekend :)
November 17, 2009 at 7:36 pm
Code Ignitor is the best!!
Seriously, block out 10 hours in your week (which is heaps) and learn this framework, do the demo tutorial etc, and you will save this back 100 times over in development time.
November 17, 2009 at 7:45 pm
Hey Stu,
thx for this article. I started to use CodeIgniter about two years ago for a bigger application. One of the strongest point of CI is its documentation. I develop websites for my company and if there is a small project that shall run on cheap hosts I often consider CI as a starting point.
For beginners CI might be very sexy. When I can freely choose I use Ruby On Rails because things are in a way better thought out (templating, partials, models with validations, i18n, plugins, gems, code generation, etc.).
CI badly needs an overhaul that implements ORM and real caching.
Kind regards
Bijan
November 17, 2009 at 7:59 pm
DooPHP and Kohana are great framewroks as well. DooPHP is the fastest PHP framework as I know, Kohana is designed based on CodeIgniter.
November 17, 2009 at 8:03 pm
Not a bad summary. I also recommend WebLegs.
November 17, 2009 at 11:55 pm
Hey i am designer .ohh a web designer always wanted to be a web developer.you suggest me from where i have to start.i am learning pHp and some time actionscript .nice article thanks. i came here via SM as your are their.:)
November 18, 2009 at 12:47 am
Article was great!
I have used symfony and codeigniter, and the arguments about those are true. So I think.
Pete
November 18, 2009 at 1:09 am
The framework that has most increased in use in the last months is Symfony. In a few month it will be upon Zend.
November 18, 2009 at 3:47 am
Kohana is far away better than ci..you should try it! :)
November 18, 2009 at 3:57 am
great job bro
i like your website too
November 18, 2009 at 4:53 am
Thanks Ocim :-)
November 18, 2009 at 5:35 am
Have you ever tried yiiframework?
November 18, 2009 at 10:13 am
CI is the framework of choise for me.
November 18, 2009 at 12:42 pm
Sounds good. I haven’t tried PHP frameworks just yet because I recently started with PHP so I thought that’d be a bit of cheating to use a framework :)
November 18, 2009 at 2:13 pm
I’ve also walked this path. Write your own classes, CodeIgniter but now I’m totally hooked on Rails. It’s way better and the inspiration for almost all PHP frameworks. Ruby is a lot more elegant and flexible than PHP and thus more suitable for using in conjunction with a framework.
Just try it!
http://www.rubyonrails.com
November 18, 2009 at 2:13 pm
nice article.
I’m .net developer. I started to search php framework for my linux projects. Finally : CodeIgniter or symfony. My choice is symfony. Because easy start not enough for me. I’m building projects more than one. Maintenance, easy configuration is important. Symfony is ready for business applications. Doctrine or propel is ready for ORM.
November 18, 2009 at 2:21 pm
I like CakePHP better than CI, because it’s easier in my opinion. You can build a blog in less then 5-7 minutes.
November 28, 2009 at 4:03 am
I like Cakephp too, for me is the best, is simple and clean. Probable CI is very good too, I didn’t try CI yet :) Anyway, good article Mr Stu. Keep writing and share your experience with us. Thanks!
November 18, 2009 at 8:15 pm
Since now I’m using codeigniter for my projects. and I love it.
November 19, 2009 at 12:35 pm
Excellent post! I’ve been using CodeIgniter for about year, and it’s made building webapps and websites a breeze!
November 19, 2009 at 2:17 pm
CodeIgniter huh? Sounds like its worth a shot. Thanks for the post!
November 19, 2009 at 8:16 pm
Nice..!!! great idea.!
November 20, 2009 at 12:59 am
Thanks for the inspiration! I have started to look into CI a little deeper and it´s exciting what you can do with just basic PHP knowledge.
As for Ruby On Rails: ruby is not often provided by hosts as PHP is.
Thanks!
November 20, 2009 at 4:50 am
Thanks Stu (Stewie? huh) for this article.
I totally agree that CI is very easy to use, but it actually miss tutorials and documentation.
I used it 2 years ago, but since then i stopped due to some stuff but willing to come back to it again and build an incredible web 2.0 website.
November 20, 2009 at 7:59 am
Great post .
But I am working on Zend framework . Its improving each day .
Though its some what a tough to start , but now its easy :) .
Community is growing . Do don’t worry :)
November 21, 2009 at 7:47 am
Thanks for the post Stu. I did similar research and I currently use CI. I wanted to add a few points to your post:
1. For those of you just getting started with PHP I’d suggest you do just that before getting into any framework.
2. One of the advantages of CakePHP is the ability to build an MVC application based only on your database schema. Build the database, enter ‘cake bake’ at the command line an it’ll run through a wizard that builds an application. There are even GUI apps like ModelBaker (Mac only) that will take care of this too. Still, CI is the right choice for me.
Nic
November 21, 2009 at 9:50 am
We explored several frameworks and settled on Code Igniter because we do a lot of Expression Engine work. EE 2 is written on CI. Other than that CI has been a real breeze to learn and has worked well for our needs so far. Honestly though had it not been for the EE connection we may have gone with Cake PHP.
November 21, 2009 at 5:08 pm
There is quite a learning curve for Symfony but that is due to it being an enterprise level framework that includes a lot of fantastic tools.
In my opinion, CodeIgniter is good for small projects with limited functionality. If your app grows to something larger, you might regret not learning Symfony.
November 26, 2009 at 8:59 am
great post Mr Stu!!
December 2, 2009 at 2:17 pm
[...] after looking at what else was there I thought I’d have a go at making my own. Thanks to CodeIgniter, I was able to build this app, called Project Bubble, in just 2 weeks. I came up with a friendly [...]
December 6, 2009 at 4:44 pm
I’ve been using CodeIgniter and it’s very useful but as some of you I’ve also heard Kohana is better, that will be next framework I try.