CakePHP… when WordPress isn’t quite customizable enough
These days, I work almost exclusively with WordPress. But there was a time not so very long ago that I shunned pre-built CMSes in favor of hand-coding (I was kind of a masochist back then…). This was partly due to me being new to the world of professional coding. I was still learning the trade, and hadn’t done things like set up a user authentication system or write a media upload script half a million times. It was new and challenging, and I needed the experience.
Eventually, I got to the point where I HAD done those things half a million times. That’s when I started getting my feet wet in WordPress plugin development.
So, why am I telling you this?
It’s because this past week, I was handed a project that WordPress just wasn’t very well-suited for. Don’t get me wrong, it could be done in WordPress… but ultimately, it would have required some seriously heavy customization. Frankly, it just seemed like it would be much easier to build it myself from the ground up. That way, the site would do exactly what I wanted it to, in the way I wanted it to do it, without having to figure out a work-around for pre-written code.
But I still didn’t want to mess around with writing code I’d already written half a million times. That’s why, for the first time in almost 3 years, I’ve gone back to my old friend CakePHP.
If you’re not familiar with it, it wouldn’t shock me. It’s not a CMS like WordPress. It’s a PHP MCV framework. What’s a framework, you ask? It’s a sort of skeleton for your web site or application that does a lot of the heavy lifting for you, while at the same time giving you the freedom to write custom code to tell that skeleton what to do. CakePHP handles things like connecting to the database, authenticating users, and input validation, but lets you make decisions like what your database stucture looks like, HOW users are authenticated, and validation rules. Rails is another MVC framework that is made for the Ruby programming language.
Cake takes some getting used to if you’ve never been exposed to MVC (model, view, controller) conventions before. In MVC architecture, the Model contains your application’s data and rules for manipulating that data, the View handles display of the output, and the Controller is in charge of accepting, manipulating, and storing the input, and sending output to the View. The result is a clean, well-organized system for your code.
CakePHP also has a solid user community. You can find help in several different forums, and there’s also The Bakery, where you’ll find any number of components, behaviors, plugins, and helpers other Cake developers have written and made publically available, as well as articles and tutorials.
WordPress is a great piece of software, but sometimes you just need a little more flexibility. CakePHP is a terrific way to get that flexibility without having to reinvent the wheel to get the basics.