CakePHP 5 Introduction

When I learn new things, I like to document what I'm doing to reiterate to myself what I've learned, to keep track of my progress, catch errors, collect disparate information into a single place, and hopefully help someone else. These are my tutorials for building a CakePHP 5 framework application.

I've been working with CakePHP since version 1.3 and I find its rapid scaffolding and quick development a godsend in my work where I have to do the jobs of multiple people. "Less with more" as they keep telling me. CakePHP uses "convention over configuration." What this means is that once you understand the conventions, much of the CakePHP functionality is automatic, saving immense amounts of time.

CakePHP follows the MVC (Model-View-Controller) design pattern, separating an application into three main parts:

  • Model: information or data (typically representing a table or view)
  • View: interface or presentation (a display such as a table, or chart)
  • Controller: linking the model to the view (accepts input and converts it to commands)

I'm using a typical WAMP stack on Windows 11, Apache 2.4, MariaDB 8.0, and PHP 8.1. Any other modern stack will use similar if not identical code. CakePHP also comes with its own built in server you can use:

bin/cake server

Your application is then accessible at http://localhost:8765

Source code for this tutorial is available on GitHub: https://github.com/naidim/tutorial