CakePHP is a free and open source rapid development framework for PHP that greatly reduces the time required to create and maintain small to large websites. I've only been using it for roughly a month, however, it has proven to be a valuable tool thus far.
For those new to CakePHP and who'd like to take a look at what it's all about, please see the main site at http://cakephp.org/ From the main site, you can download it (the newest stable release as of this post is version 1.2.0.7125) as well as learn the ins and outs of this tasty cake!
But why should you use CakePHP? How does it help?
Well, CakePHP organizes all the files for your web application into 3 different categories - Models, Views, and Controllers (MVC design pattern). Models are much like gateways to your database, Views are the HTML/PHP pages that displays the data, images, or information. The Controllers are where the main functions of your web applications reside.
Let's look at an oversimplified example of the MVC design pattern:
A user wants to post a comment on your blog. She types in her message and clicks on the "Post!" link to post her comment. The data is sent to the Controller, the Controller then sends it to the Model which inserts it into the database. After being inserted, data is sent to the View and you see your "The Post was Saved Successfully!" message.
Why would you want your code separated like this? Because it's a lot easier to maintain. Furthermore, if you have an error you need to fix, you know almost exactly where to look for it. Is it a database error? Check your Model or your database. Is it a template issue? Check your view.
CakePHP also has many built in functions and helpers that help you quickly, easily and (usually) painlessly find information from your database, manage user permissions, use AJAX and even display forms (to name a few).
I would highly recommend viewing the CakePHP manual (aka "The Cookbook") for more information and for a much better explanation of how things work, what you can do, and what you can't. You should also take a look at the Blog tutorial located in the Cookbook for a walk through of many useful functions to easily create a Blog. The cookbook can be found at http://book.cakephp.org/view/7/introduction-to-cakephp.
As I learn more about CakePHP, I'll be posting more blogs about it, what problems I've had with it, and how to get around those problems.
Until then,
Happy Baking!
Tuesday, June 17, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment