CakePHP: Initial Thoughts

Despite my previous proclamations, I'm not actually against the idea of using a framework (and in case you're actually not sick of hearing about it, I might have another framework post up my sleeve). But let me set that issue aside. This is really about CakePHP. And I've decided to jump in head first for this project I'm working on.

For those of you unfamiliar with it, it's yet another MVC framework, much like Ruby on Rails and Django, except it's in PHP. Keep in mind, this article isn't a comparison of CakePHP versus these other frameworks but simply to highlight what I like or don't like about my limited exposure to the framework so far.

Getting set up

Installation was nice and smooth. I dumped the download into a folder on my dev server and loaded up the page in my browser. Much to my surprise, there was a page greeting me telling me what to do. No database configuration information. Off I went to configure the database. I created an empty database and came back to refresh the page. A nice message told me it could connect to the database. It also points me to how to change the layout and the content for the default page. How helpful! Changing the default look and feel for the application was a cinch and reading up on how to change these defaults gave me a greater sense of how the entire application works.

Just for fun, I went to a dummy url. And wouldn't you know it... more helpful information. It tells me how to create my controller with a nice little code example and where to put it. Once that's done, and I refresh the page, it tells me my model is missing - once again with code and location. Refresh. It tells me I need a table. Refresh. I need a default action for my controller. Refresh. Now it tells me I need my views. Who needs documentation when it tells me how to do everything?

An aside: I'd be incredibly impressed if it had a wizard that let me create the shell for all of this automatically; including a wizard for setting up the database table for the model.

Documentation

Now that I actually need to program something, I delve into the documentation. Unfortunately, this is where things begin to falter. The site is a little scattered. Documentation lies in one of three places: Manual, API, and Wiki. Although, plans are in the works to replace the Wiki with the Bakery, which seems to be a centralized place for people to post CakePHP articles.

The manual is pretty good but is light on content with some sections missing entirely. The wiki, on the other hand, seems to have more content but feels clunky and has numerous errors — usually grammar but even weird things with words or sentences appearing out of place, like some drag and drop gone wrong.

Just beginning

I'm just getting into things so I hope to be able to report more on this framework.

Published June 14, 2006 · Updated September 14, 2006
Categorized as CakePHP
Short URL: https://snook.ca/s/613

Conversation

23 Comments · RSS feed
sosa said on June 14, 2006

I'm glad you are trying Cake. I've been using it for six releases or so and I can tell you something: It keeps getting better and better.

btw, I agree the Bake.php script is wonderful!

Jesse Skinner said on June 14, 2006

Have you checked out Code Igniter? It's fairly new, from the makers of Expression Engine. It's super simple and basic but it's perfect for PHP coders who want the minimal MVC stuff (and a couple extra cool helpers).

The day after I found it I recoded my blog, which took less than 5 hours.

Poncho said on June 14, 2006

I've been fiddling with CakePHP for a couple of months now and have built my last three projects with it and I am smitten.

I wouldn't say I'm a brilliant programmer, but I generally know my way around. Cake's way of doing things just seems simple, logical and obvious. It's not fetaure-complete though...

I think the validation could use some love (which is underway in the 2.x codebase), but other than that, it's pretty awesome :-)

@lesse Skinner
I had a look at CodeIgniter when it was first released and I was pretty impressed, but it lacked Models at the time, maybe I should take another look...

Cheers;
Poncho

Jonathan Snook said on June 14, 2006

Jesse: I've checked out the site but the documentation is poorly laid out (but at least all in one place). The table of contents link needs to be in a much more obvious location but would be even better if it was on every page.

Django has one of the best sites when it comes to demonstrating and documenting the strengths of the framework and the other ones could learn a thing or two from them (including Ruby on Rails).

Andrew said on June 14, 2006

I'm looking at all three of the mentioned frameworks (Django, CakePHP, RoR) for my next project, and I have to say that I liked Django the best of the three. Perhaps it's just my PHP background that's holding me back, but I don't like writing in Ruby, and it felt all too much like black magic.

I'd fallen in love with Django, but there were deployment issues, namely that the server has to be restarted every time you make a change to the code (this was a big deal for my hosting provider). That leaves (you guessed it) CakePHP. No mod_python, no mod_fcgi, just nice and simple mod_php.

I'm hoping that it works out, and I'm looking forward to your followup post on CakePHP.

Poncho said on June 15, 2006

@Andrew

Give the CakePHP Google Group a look if you're having any problems or need advice.

Cheers;
Poncho

Poncho said on June 15, 2006

@Jonathan

I agree that Django's website is one of the best around for documentation and example code. Its template language is very smarty-like also, which is good (if you've done the whole Smarty thing). I really like the look of Django in general, although I don't really fancy learning yet ANOTHER new language though, so I'm sticking to php with Cake :-)

@Andrew

Give the CakePHP Google Group a look if you're having any problems or need advice.

Cheers;
Poncho

Jesse Skinner said on June 15, 2006

@Jonathan - It took me some time to find this too - the Table of Contents tab on the top of every page opens a hidden table of contents with some JavaScript animation. So every page actually contains the table of contents.

Olle Jonsson said on June 15, 2006

Very glad to see some recognition of CakePHP's fine learn-as-you-code introduction. It kick-starts you.

Welcome to Cake-land, Jonathan.

Jonathan Snook said on June 15, 2006

Jesse: wow, I can't believe I missed that tab sitting there. duh.

Troy Schmidt said on June 15, 2006

I also wanted to second the Google Groups. Also, feel free to stop by the IRC channel on freenode. #cakephp as the developers themselves reside in there often (sometimes for days at a time). At one point I began to wonder if artificial intelligence was developing the project.

Derek said on June 15, 2006

Let me second the motion for Code Igniter. Cake is a FINE peice of work, but after having used both, it would take a lot for me to switch back to Cake.

donkeyKong said on June 20, 2006

it looks nice at first and you start pretty quickly but once you want to use some advanced techniques cakePHP shows its ugly face to you. cakePHP suffers from design flaws. it is almost imposible to decouple anything there.
i woludn't advise anyone to use it in production.

Jonathan Snook said on June 21, 2006

donkeyKong: I'm definitely noticing that unclear documentation is it's largest downfall but I'm not sure why you couldn't use it in production. For straightforward models, Cake should handle itself fairly well. I've even pondered dumping MovableType for a custom built Cake application.

Joao said on July 20, 2006

@ Andrew
Sometimes you dont have to restart Apache, in most cases a rm to your .pyc file will force mod_python to compile yout .py file again..

CakePhp is a nice framework, but my pick would be Django, it does creates the tables for you and much of the work is done using the admin script but.. error handeling is not that easy.. CakePhp wins on that, but not many servers support it..

BBEr said on August 19, 2006

I agree with previos posts; cake out of the box is amazing. I love the scaffolding idea; I love entity object mapping that it provides. However, when trying to build anything outside of that, development seems slow and ardous. I must confess, however, that I'm still learning the API and documentation. I am optimistic about future support for cake; it seems to have a good user base with people who are interested in it's success.

D Jones said on January 13, 2007

I have been using the Zoop Framework for a while now and am very impressed with it. It shares a similar documentation downfall, but I have found it easy enough to use. Additionally in my experience it has been more flexible than cake. It appears to resolve many of the problems mentioned above. If your search for a framework led you here, I would recommend trying it out.

Programador web said on May 01, 2007

Cake is a great framework! Simple, powerful, object oriented and fast to learn.
The only problem is there isn't a good book about it with real problems and solutions; maybe Cakephp Recipes by Fabio Cevasco could be the answer to this pray but it isn't printed yet :(

tester said on September 25, 2008

4 vgts dgs dfg sdfg sdfgfds sdfgsdfg

Kiran said on November 11, 2008

Thanks Jon for my graduation gift! I have been taking small projects as a student to earn my rent and stuff but CakePHP definitely will enhance my productivity and hopefully will help me get a good first job!

Congrats on being featured as the world's top web developer :)

UK hosting said on November 27, 2008

The CakePHP documentation has come a long way since this article was posted. I've been using version 1.2 recently for a project.
I found the website documentation and API to be excellent resources.
In my opinion, CakePHP is a very good framework and with the bake script you can get the basics of a project up and running very quickly.

gruzoperevozki said on February 08, 2011

Интересно написано, но мне кажеться я уже это где то видел...)))

profnastil said on February 08, 2011

Добрый День!
Вы решили заняться перепланировкой ?
Наша производственная Фирма занимаеться продажей металлопроката в Киеве и Области.
Имея свой автопарк, мы имеем возможность осуществлять доставки металлопроката,
что существено сказывается на стоимости и откидывает далеко назад всех наших конкурентов.
Наши цены на металлопрокат самые низкие за счет прямых поставок металлопрокта с заводов и комбинатов.
Так же мы постоянно производим
производим профлист

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.