PHP Frameworks, Why you should be using them!

Over the christmas break, I decided to get my hands dirty, and do some coding for some projects I’ve been wanting to get started for the past few months, but have been too busy to start working on. A great thing about working on personal projects is that you have the ability to test out new technologies, and techniques, without worrying about the commercial implications if you dont something correct the first time.
I knew i wanted to write some PHP applications, and wanted to take a strict MVC approach to coding them. The advantage of this is that my code would be cleaner and easier to manage.
So what is a framework some people may be asking. As a very basic definition I would say it is a collection of classes and functions which will reduce the amount of coding you have to do, which will enable you to perform common tasks.
I’ve had some experience using the following frameworks before; Adobe’s dreamweaver developer toolbox / Interakt’s MXKollection & Joomla! However i didnt want the overhead each carried with them. MXKollection is outdated, huge and generally pretty horrible to work with if you don’t to click and drag ‘components’. Whilst Joomla! is alot sleeker, lighter and more up to date. However the one disadvantage in my eyes is you have to rely on using a Joomla! site, as the base of your site.
So I started to look for other alternatives, and i came across CodeIgniter, some how it seemed to appeal to me more than CakePHP, Symfony and Zend. I do admit the others were tempting but just didn’t seem to fit the bill correctly for what i was looking for in the framework. CodeIgniter seems to be most flexible, lightweight PHP based framework out there, and seemed rather easy to learn from the user guide (which is fantastic! i might add).
Now i had picked my framework, i wanted to start learning how to use it and get it configured, i started working my way through the user guide, which took a mere hour and an half. Got the example blog up and running, so though i might start building my first application.
My First Application.
The first application i wanted to start making was a basic one, essentially it was a job board, where organisations and individuals would be able to go to a site, and post job vacancies. The jobs vacancies would then be made public.
Two of the features i wanted to integrate, were that i wanted the jobs to be categorised, so users could pick an industry and it would show all jobs from that industry. Also I wanted a basic search form, so users could enter job titles, or a location, so they could find jobs with similar titles, or in a specific location.
I got the application up and running using codeigniter, in under 6 hours, with me writing less than 250 lines of code, (note this does not include views). If i was writing the same application without using a framework i would easily be quadrupling the amount of code, i would be writing.
As a php framework, codeigniter would probably suit most develpers. It has enabled me to write clean, uncluttered code, and has caused me to start writing other applicatons which i can throw up in a short period of time. One of the really nice features i would have to say about codeigniter, is the way in which code igniter, implements validation of forms (using server-side methods) , and its security features. The validation class will save you literally hunderds of lines of code if your form has multiple inputs, which are content sensitive. E.g. data must be required, or it must be of certain type.
So i thoughrly recommend you take a good look at frameworks if your thinking of building any apps, and if your not sure which is right for you why not give CodeIgniter a go.
Photo credit goes to Kaz K
Tags: code igniter, codeigniter, framework, frameworks, php, web development