Latest in branch 3.8
3.8.13
Released 19 Jun 2020
(5 years ago)
SoftwareCakePHP
Version3.8
Status
End of life
Supported
PHP versions
PHP 5.6-7.4
Initial release3.8.0
27 Jun 2019
(6 years ago)
Latest release3.8.13
19 Jun 2020
(5 years ago)
End of security fixes15 Dec 2022
(Ended 3 years, 5 months ago)
Release noteshttps://github.com/cakephp/cakephp/releases/tag/3.8.13
Source codehttps://github.com/cakephp/cakephp/tree/3.8.13
Documentationhttps://book.cakephp.org/3/en/index.html
Downloadhttps://book.cakephp.org/3/en/installation.html
CakePHP 3.8 ReleasesView full list

What Is New in CakePHP 3.8

CakePHP 3.8 introduces several key updates focused on modernizing the request/response layer and refining core components. This release sets the stage for future improvements while maintaining strong backwards compatibility.

Category Key Changes
New Features PSR-15 Middleware support, New Application class, New Command interface.
Improvements Refined Cache and Log engines, Updated Table::findOrCreate(), Better typehints.
Deprecated Legacy Dispatcher, Controller::$modelClass, Network\CurlRequest.
Bug Fixes Various fixes in ORM, Database, and View layers.

How does middleware work in CakePHP 3.8?

CakePHP 3.8 adds experimental support for PSR-15 middleware, a significant shift towards standard HTTP request handling. This is implemented through a new Cake\Http\MiddlewareQueue and a revamped Application class that replaces the traditional dispatcher setup.

In practice, your src/Application.php now defines a middleware method where you can queue middleware. This approach is more flexible and interoperable with components from other frameworks.

// In src/Application.php
public function middleware($middlewareQueue)
{
    $middlewareQueue
        ->add(new ErrorHandlerMiddleware(Configure::read('Error')))
        ->add(new AssetMiddleware());
    return $middlewareQueue;
}

What changed in the Application bootstrap?

The bootstrap process is now centered around the Application class. The old Dispatcher is deprecated. Your webroot/index.php file now creates an instance of your Application and runs it.

This change unifies configuration and service setup, making the application's lifecycle clearer. It's the foundation for the new middleware system.

// New webroot/index.php
use App\Application;
use Cake\Http\Server;

$server = new Server(new Application(dirname(__DIR__) . '/config'));
$server->emit($server->run());

Are there updates to Cake Console?

Yes, the console system gets a cleaner interface with the new Command interface. Commands now implement CommandInterface instead of extending Shell. The ConsoleIo class handles input/output, promoting better separation of concerns.

This matters because it aligns CakePHP with modern CLI library patterns and makes testing commands simpler. The old Shell class still works but is deprecated.

use Cake\Console\Arguments;
use Cake\Console\ConsoleIo;
use Cake\Console\CommandInterface;

class MyCommand implements CommandInterface
{
    public function execute(Arguments $args, ConsoleIo $io)
    {
        $io->out('Command executed.');
        return null;
    }
}

Cache and Log Engine Refinements

Cache and Log engine classes received updates for better consistency. The CacheEngine::get() method now requires a callable as its second argument for providing default values, matching the signature of Cache::remember().

For logging, the LogEngine::log() method is now strictly typed to accept only string levels. This prevents runtime errors from invalid level types.

Deprecations to be aware of

Several legacy features are marked for removal in CakePHP 4.0. Key deprecations include:

  • Dispatcher and related classes (use Application).
  • Controller::$modelClass property (use loadModel()).
  • Network\CurlRequest (use Http\Client).
  • Shell class-based console commands (use the new Command interface).

Your application will still run, but you'll see deprecation notices. Addressing these now eases the future upgrade path.

FAQ

Is upgrading to CakePHP 3.8 from 3.7 risky?
No, it's a safe and recommended upgrade for most applications. The changes are largely additive, introducing new middleware and console interfaces while keeping full backwards compatibility. You will see deprecation notices for old features, but they will not break your app.

Do I have to use the new middleware system immediately?
No, the old dispatcher system still works. The middleware support is experimental in 3.8. You can adopt it gradually or wait until you upgrade to CakePHP 4.x, where it becomes the standard.

What happens to my existing Shell classes?
They continue to work but now trigger a deprecation warning. You should plan to migrate them to the new CommandInterface based system. The new system is more testable and follows a cleaner design.

Why was Table::findOrCreate() changed?
The behavior was refined to ensure it works correctly within transactions. The method now uses Table::saveOrFail() internally, which means it will throw an exception on failure instead of just returning false. This makes error handling more explicit.

Can I use PSR-15 middleware from other libraries?
Yes, that's a primary goal. The new MiddlewareQueue is fully compatible with the PSR-15 standard. You can integrate middleware packages from the broader PHP ecosystem directly into your CakePHP application flow.

Releases In Branch 3.8

VersionRelease date
3.8.1319 Jun 2020
(5 years ago)
3.8.1208 May 2020
(6 years ago)
3.8.1106 Apr 2020
(6 years ago)
3.8.1022 Feb 2020
(6 years ago)
3.8.925 Jan 2020
(6 years ago)
3.8.829 Dec 2019
(6 years ago)
3.8.708 Dec 2019
(6 years ago)
3.8.607 Nov 2019
(6 years ago)
3.8.507 Oct 2019
(6 years ago)
3.8.414 Sep 2019
(6 years ago)
3.8.331 Aug 2019
(6 years ago)
3.8.209 Aug 2019
(6 years ago)
3.8.113 Jul 2019
(6 years ago)
3.8.027 Jun 2019
(6 years ago)
3.8.0-RC313 Jun 2019
(6 years ago)
3.8.0-RC219 May 2019
(7 years ago)
3.8.0-RC130 Apr 2019
(7 years ago)
3.8.0-beta131 Mar 2019
(7 years ago)