CakePHP Tutorial

CakePHP is a full-featured PHP MVC framework built around one core idea: convention over configuration. If you name your files, classes, and database tables the way CakePHP expects, most of the wiring — routing, model loading, view rendering — happens automatically, with almost no configuration required.

Where this fits: CakePHP is a bigger step up from Core PHP than Slim was — it comes with its own ORM, form helpers, and validation built in, rather than you assembling pieces yourself. Composer knowledge from the Composer track is assumed here too.

Convention Over Configuration

If you have this...CakePHP automatically assumes...
A database table named articlesA Table class named ArticlesTable
A controller named ArticlesControllerUses the Articles model automatically
An action method named view()Looks for a template at templates/Articles/view.php
A URL like /articles/view/5Routes to ArticlesController::view(5) — no manual route needed

A Quick Look Ahead

Example: A Minimal Controller Action

<?php
namespace App\Controller;

class ArticlesController extends AppController
{
    public function index()
    {
        $articles = $this->Articles->find()->all();
        $this->set('articles', $articles);
    }
}
Note: This is correct, real CakePHP code — but this website's own project doesn't have CakePHP installed, so you won't see it actually run on this page. Follow along in your own project after the next page's installation steps.

Why Learn CakePHP?

ReasonWhat it means for you
Fast to build withConventions mean less boilerplate and configuration than many frameworks
Built-in ORMQuery, save, and validate data without writing raw SQL for common cases
Batteries includedForm helpers, security features, and validation ship with the framework
Mature and stableLong-running project with a strong upgrade path and active community
Next steps: Head to Installation & Setup to create your first CakePHP project via Composer.