CakePHP Introduction, Tutorials, and Resources
CakePHP is a web application development framework designed to make it easy and quick to build new PHP apps. The design of CakePHP follows two principles: "batteries included" and "convention over configuration." These two principles make it relatively easy to get a new app off the ground, even if you're an inexperienced PHP developer. (Obviously, the more you know about PHP, the more you will be able to get out of CakePHP.)
CakePHP enforces conventions at the macro and micro level.
At the macro level, it follows the model-view-controller (MVC) architectural pattern. This is a way of organizing the code for an application into three core components:
- the model, which defines how data is organized;
- the view, which defines how data is displayed;
- the controller, which defines how data is managed and manipulated.
At the micro level, CakePHP has conventions (a "one right way") for everything from naming things, to folder structure, to URL capitalization. It is possible to ignore some of these conventions, but there usually isn't any compelling reason to do so. And if you do follow these conventions, a number of things happen " automagically."
For example, if you follow the conventions properly, CakePHP getting your model classes, your view templates, your database tables, and your URL structure to cooperate becomes a trivial matter. Since you don't have to re-invent the wheel for each new data type, you can focus on the problem you are trying to solve and get things done faster.
Another way that CakePHP helps speed up web development is through its command line tool. This gives you the ability to quickly spin up a new application skeleton, add new models and views, launch build processes, run tests, and manage deployment.
The best way to learn about CakePHP is to just dive in and start using it. These tutorials will help you do exactly that.
- CakePHP Tutorial: Build Web Apps Faster is a very practical, code-heavy tutorial, using a movie catalog app as an example.
- What is CakePHP? provides an "executive summary" of the framework — a good place to start for helping non-technical stakeholders understand the benefits.
- These slides from a CakePHP tutorial presentation (PDF) are a bare-bones, but still very useful, basic overview of how to get started with building a CakePHP app.
- How To Create a Small Web Application with CakePHP on a VPS is an excellent two-part tutorial with practical advice on not only coding an application, but also deployment and hosting. This tutorial was created by and for Digital Ocean, but is mostly applicable to any VPS hosting plan.
- A Complete Social Login Application Tutorial for CakePHP gets beyond the usual toy-apps of most tutorials and shows you how to build a working, non-trivial application in CakePHP.
- CakePHP Tutorial for Beginners is a simple tutorial that will help Cake newbies get started with the framework.
- Learn CakePHP 3: The Basics is a four-hour premium (paid) video course from Lynda.com.
- Learn CakePHP is a 7-part tutorial from cakecoded.com.
- CakePHP Tutorial is a blog with full-scale tutorials, helpful tips, and other useful content related to CakePHP.
- The CakePHP Official Repository is available at GitHub.
- The CakePHP Cookbook is the official, community-developed introductory documentation designed to get new Cake developers off on the right foot.
- CakePackages is the official directory of plugins, modules, extensions, and other tools for CakePHP.
- Turnkey Linux provides a rapid-deployment Linux image with CakePHP and all needed dependencies, along with easy tools for running on various virtual machines and deploying to Amazon.
- Cakephp-Tools is a CakePHP plugin containing lots of useful and reusable tools.
- Awesome CakePHP is a curated list of the best and most interesting tools for CakePHP.
CakePHP has a very active development community who are passionate about the framework.
- The Bakery is the official CakePHP blog.
- CakePHP has an official Facebook page, and also a community fan page.
- CakePHP (@cakephp) is the official Twitter account of the CakePHP project.
- CakePHP has an official forum, which is a great place to ask questions and interact with other CakePHP developers.
- There is also a CakePHP subreddit.
- A CakeFest is a conference for CakePHP developers.
Books on CakePHP
- Rapid Application Development with CakePHP 2.0 (2014), by Jose Diaz-Gonzalez, is the most up-to-date print book available for CakePHP, written by one of the framework's core developers.
- Beginning CakePHP: From Novice to Professional (2008), by David Golding, is the classic, definitive introductory book on CakePHP. Unfortunately, much of the information here is out-of-date.
- Building PHP Applications with Symfony, CakePHP and Zend (2011), by Porebski and Przystalski, is a good book for PHP developers who want a comparative view of the most popular development frameworks.
- Learn Cakephp: With Unit Testing (2016), by Golding, Gomori, and Dasa, is a short book that shows how test-driven development (TDD) can be used with CakePHP.
- Practical CakePHP Projects (2008), by Miller, Omokore, and Chan, is a popular book on the framework which walks readers through the development of several real projects. Like Beginning PHP, this book unfortunately hasn't been updated for the latest versions of the framework.
Should I Learn CakePHP?
If you are a PHP developer, you might want to. CakePHP isn't the most popular framework, but it is consistently in the top ten. It's main focus is on being a "rapid development" platform, and it has a strong "convention over configuration" philosophy. This means that even though CakePHP doesn't support all the bells and whistles of PHP 7, you can still use it to build new apps, with minimal hosting requirements, very fast.
Further Reading and Resources
We have more guides, tutorials, and infographics related to web development:
- PHP Introduction and Resources: learn all about the language that Laravel is coded for.
- Zend Optimizer Hosting: Zend is one of the most popular PHP frameworks around. Learn the basics here and where to get hosting for it.
What Code Should You Learn?
Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn? It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming PHP for a living?"