Categories
Blog

Building a Cake

For the two weeks or so, I’ve been dabbling with CakePHP, which has been something of a painful experience.  My pain comes from meshing my PHP experience into a Rails frame of mind, which is essentially what CakePHP is.  PHP on Rails if you’d like, though, it doesn’t do all of what I’ve come to expect from rails.

Migrations are something I miss, though I’ve been seeing some progress on that front on GitHub.

Another thing I’m having trouble getting my head around is that I’m using PHP to write Rails-ish concepts and code, which is weird. Normally I don’t have this problem with context switching, but I find my Ruby brain being overpowered by my PHP brain.

Like Rails, it works best to define a default database config file, and Cake does this for you in the config directory, where you get a database.php.default, instead of the database.yml file in Rails.

Again, it’s these little things that get you.  From what I’ve seen, you can make CakePHP more Rails-like, but the way I see it, if you need to write Rails or Ruby, use Ruby on Rails.

CakePHP is a great product, despite some of the gripes I’ve seen.  If you want to do some rapid prototyping, but need to use PHP, such as if you’re a PHP shop, or that’s your strongest language, go bake a cake.

Here are some useful links to get you started:

http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html

http://net.tutsplus.com/tutorials/php/getting-started-with-cakephp/