First look at CakePHP
Finally, I found some time to take CakePHP for a spin. I’ve heard some really good things about it, and I’ve been trying to get some time to try it out. I installed the framework and went through the tutorial on building a simple blog application. I have to say I’m quite impressed.
CakePHP is an MVC PHP framework.
MVC stands for Model-View-Controller. It is what’s called a ‘design pattern’ in the programming sphere. It’s a way of looking at the parts that makes up an application - in this case 3 parts, the model represents the application data, the view represents it’s presentation, and the controller is the glue that ties the data to the presentation. I’m not going to go into detail about this, you can google for plenty of materials about MVC, or just give any MVC framework (like CakePHP) a try and you’ll get the idea.
Bearing in mind, I’ve only just completed the CakePHP tutorial, but this is what I found out about it.
Easy to get it going
Between downloading the installation files and setting it up to run on my XAMPP install probably took about 5 mins to show the CakePHP default screen. The hardest part about it was to turn on my Apache rewrite module, even then, the documentation was quite clear about what I had to do.
Very natural and fast
Clearly, the tutorial has shown that it’s possible to rapidly develop applications. But realistically speaking, the real world apps are not made with one database table. I’m sure it’ll take longer than a few minutes to really pull together a real application. However, between building the same application from scratch and using CakePHP, CakePHP will still win hands-down because a lot of the fundamental stuff has already been taken care of.
Good programming standard
There’s a world of difference between one person developing an application versus a group of people working on the same application. Certain standards needs to be enforced, so that the group can work more efficiently and effectively. This is where CakePHP excels, the underlying framework forces the programmer to adopt a certain conventionof writing their code , this makes it easy for the next guy to come along and pick up where the first guy left off.
Suitable for beginners?
Now that I’ve hands-on on a framework like CakePHP, I would definately look at adopting it and working my next project with it. But are frameworks suitable for beginners learning PHP? I don’t think so. The frameworks adds another layer of complexity to the whole learning process if you haven’t grasped the basics like object oriented programming, etc.
I would say this framework is best for programmers who have completed one or two major PHP applications, and looking to stablize themselves in a standardized approach and improving their productivity in developing applications.
- Review: Programming PHP (2nd Edition)
- CakePHP: Working with ‘Associations’
- Why should you use PHP?
- Creating simple graphs using Google Charts API
- What is PHP?






Heh I can identify with that stage you described where I’ve written a few major things and now I want to start doing things the proper way because i’m pretty sure whoever’s going to inherit my old code will hate me! If you like cakePHP you might like kohana/code igniter which I’ve been playing with too.
Great post, and I agree with everything you’ve said except that beginners shouldn’t start with CakePHP or a framework of some kind. While it definitely adds a layer of complexity and will be harder to learn initially than just straight PHP, hopefully that will avoid that coder learning some really bad habits that may be hard to break later on.
In the worst cases, I’ve seen PHP developers who were so entrenched in their awful coding habits that they refused to go through the added hassle of learning a framework later on.
The fact that you can just jump in and use PHP for whatever is a great strength, but also a great weakness. I really wish that I had started with a framework or two so that I could have learned the right way to do things rather than the easy way. It would have saved me a lot of time in the long run and made me a much better developer.
Keep up the good work!
[…] a recent post to the Ask About PHP blog, there’s a quick “first look” at the CakePHP framework […]
Aye, I agree with Waggoner here.
I’ve taken a few programming courses, mainly to get that sheet of paper to show I can (or should be able) to program. What I found to be the worst in every course i’ve taken on programming is that OOP is regarded too advanced.
I say it’s such a integral part of building good applications it should be fed with the spoon as early as possible. They way its done now is like teaching someone how to the chacha before teaching them about rythm and such.
The problem however, is that cakePHP will be hard to grasp without any knowledge of OOP. First someone should learn to build a little framework himself, very basic before jumping on a vast frame work as this.
Good to see CakePHP getting some love. I’ve been building pretty complex apps with cake for a couple of years and it certainly does make life easier for the developer.
I agree that it would be best to learn a framework after becoming comfortable with OOP programming in general, as well as completing a few applications.
I myself had got to the stage of using DB libraries, class-table relationships and template engines (without realising I was using the MVC pattern) before I discovered CakePHP, so it came pretty naturally to me.
CakePHP offers some pretty advanced features with a minimum of effort including; incredible URL routing, easy database relationships, full data sanitisation & validation, plenty of useful components (Security, Session, Cookie, Request, Auth, Email) and view helpers (html, form, session, etc.).
I won’t even go into the command-line tools, I will just say that they are incredible powerful.
After trying out a lot of CMS and frameworks, I found CakePHP offers an awful lot of value for the little structure it imposes (such structure is both useful and ‘guessable’).
Cheers;
Poncho