Snook.ca

CakePHP, is it worth it?

After a few weeks of getting into the down and dirty of CakePHP, the question is, "Is it worth using?"

The answer to that question is, "it depends". The application does quite well when working with simple models. This is when the application is the funnest to play with. Putting together a blog application, for example, would be really straightforward. What I've discovered, though, is that while some development often breaks away from this, there's still nothing preventing you from building the application your way. I often feel dirty using my own SQL to pull out an unusual resultset but CakePHP still lets me do it. While it's letting me do my own thing, it even gives me some tools to make this easier.

An example of this was retrieving some form data and then creating a bunch of new records from that data. I couldn't just save my model and be done with it but I was able to create my loop, build up my data, and then save each block of data to the database. This still saved me time of having to build my own framework to do this type of work.

And if I feel like I need something that CakePHP doesn't offer, there's a number of avenues available like components, helpers, and elements (plus much more) where I can build those features in.

How does it compare?

How does it compare to other frameworks like Code Igniter, RoR and Django? Unfortunately, I'll have to leave this one up to you to figure out on your own. I think it's a case of "different strokes for different folks." I think each brings to the table its own set of strengths and weaknesses and that it really depends on what your requirements are.

What about documentation?

Yeah, okay, a bunch of my posts on CakePHP have made mention of what I felt was lacklustre documentation. So, I've decided that instead of complaining about it, I'm actually going to do something about it.

I've joined the CakePHP documentation team and have made some recommendations on moving forward. John Anderson, the documentation project lead, has a good handle on things and I fully expect the next couple months will produce a decent manual along with other materials to make working with CakePHP easier.

I've also started up another blog called With Cake. I'll be posting all my Cake tidbits over there as I really didn't want to clutter up this blog to much. It'll also give me the opportunity to link to general CakePHP news, external CakePHP tips and even have other authors contributing to the blog. If you're interested at all in what Cake can do, I recommend checking it out.

Conversation

Looking forward to what you have to bring with the new website. I have been playing with it a little on and off over the past month. I was initally worried about how SQL was handled, but after structuring my models more effectively and defining table relationships it has made things much easier. This way, I dont have to write a bunch of left joins manually in a model, but define the relationship and create objects from that.

Overall, I like it. I like it better than the Zend framework I played with for a few weeks.

People love to compare frameworks like Django, Rails, and Symfony (in fact, there's some benchmarks on rubyonrails.com just posted today), but they often forget that all of these frameworks actually have more in common than they have differences.

But there is one major difference between each of them, and for practical purposes, it's probably the one most people will make their decision based on: the language.

If you already know PHP inside and out, then it makes sense that you'd look at Cake or Symphony. If you're a Pythonista, you go to Django. If you do Ruby, use Rails.

(All that having been said, the advantages to languages like Python and Ruby are well-documented by now, so if you're only a PHP hobbyist and are planning to learn something in depth, it may make sense to make the switch now, rather than continuing to delve in PHP.)

I've just started evaluating a couple of PHP frameworks myself (CakePHP and Codeigniter) and so far (which is not very far at all!) i have found the documentation and website for Cake somewhat confusing, inconsistent and of dubious quality control, so it's definitely great news that you're getting involved there. I'll write something up myself when i've finished evaluating...

To use one of these frameworks for my projects i will need to have complete confidence in the quality/robustness of the code, and if the documentation hasn't even been spell checked or proof read then i start to wonder how much attention to detail is there in the code itself?...

Cake is totally worth it! The last few websites I've done have started out as moderate 'editable content' deals but they ended up being much more than that. If it weren't for Cake, I dread to think how long it would've taken me to implement the host of features that were required.

Put simply: Cake makes you work in a more structured manner making code addition and maintenance a breeze. *

* It could be argued that general MVC allows this, but as you point out, the helpers, components etc. are really handy and let you get on with the task at hand.

I would definitely agree with Jeff Croft on this one. It is different strokes for different folks. It all depends on your language of choice, and your experience with that language. Personally, I love PHP and as such have stuck with that.

I like the Zend framework - and there are many GREAT things about it, it is still too new for my liking and some major areas are still in development (DBA layer, etc). So - while I love all of the pieces to the ZF (I have read all documentation and played with it), the support and documentation available for cake is much larger at this point. So, if you are looking to get started right away, Cake would be your best bet.

Codeigniter is good - but in all reality, I thought it to be VERY similar to CakePHP in many aspects. There are other frameworks out there, symfony, zend, cake, codeigniter, etc - and out of those - cake and codeigniter seemed to be the most closely related (especially in terms of their naming specifications).

I started playing with Cake recently and I have to agree with Mark Hadley, the documentation is difficult to navigate. I actually abandonded the use of Cake after starting a project in it because I don't have the time to waste trying to get everything working on my remote server. Frustrating, because this would be a great framework if it had proper docs.

I think like anything, it takes time to learn. I agree that the cakephp documentation needs work, but their support on google groups and IRC is great. It took me awhile to pick up the basics of cake and I'm still learning new features as we speak, but in the end I feel it's worth it. I'm glad you're helping out, Jonathan.

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

Want to learn about scaling CSS for large projects?

I'm available for full and half-day workshops on scalable CSS architecture. I can provide on-site training for your team. Interested? Get in touch.