CakePHP 3.2.0 Released

The CakePHP core team is happy to announce the immediate availability of CakePHP 3.2.0. This is the first stable release for the 3.2 branch. Going forward 3.1 will only receive security updates. 3.2 is a backwards compatible release with 3.1 and 3.0 and provides new features and performance improvements.

Minimum PHP 5.5 Required CakePHP 3.2 requires at least PHP 5.5.9. By adopting PHP 5.5 we can provide better Date and Time libraries and remove dependencies on password compatibility libraries.

Disabling Deprecation Warnings Upon upgrading you may encounter several deprecation warnings. These warnings are emitted by methods, options and functionality that will be removed in CakePHP 4.x, but will continue to exist throughout the lifetime of 3.x. While we recommend addressing deprecation issues as they are encountered, that is not always possible. If you’d like to defer fixing deprecation notices, you can disable them in your config/app.php: 'Error' => [ 'errorLevel' => E_ALL & ~ E_DEPRECATED & ~ E_USER_DEPRECATED , ] The above error level will suppress deprecation warnings from CakePHP.

Carbon Replaced with Chronos The Carbon library has been replaced with cakephp/chronos. This new library is a fork of Carbon with no additional dependencies. It also offers a calendar date object, and immutable versions of both date and datetime objects.

CorsBuilder Added In order to make setting headers related to Cross Origin Requests (CORS) easier, a new CorsBuilder has been added. This class lets you define CORS related headers with a fluent interface.

RedirectRoute raises an exception on redirect Router::redirect() now raises Cake\Network\Routing\RedirectException when a redirect condition is reached. This exception is caught by the routing filter and converted into a response. This replaces calls to response->send() and allows dispatcher filters to interact with redirect responses.

ORM Improvements Containing the same association multiple times now works as expected, and the query builder functions are now stacked.

Function expressions now correctly cast their results. This means that expressions like $query->func()->current_date() will return datetime instances.

will return datetime instances. Field data that fails validation can now be accessed in entities via the invalid() method.

method. Entity accessor method lookups are now cached and perform better.

Improved Validator API The Validator object has a number of new methods that make building validators less verbose. For example adding validation rules to a username field can now look like: $validator->email('username') ->ascii('username') ->lengthBetween('username', [4, 8]);

Console Improvements Shell::info() , Shell::warn() and Shell::success() were added. These helper methods make using commonly used styling simpler.

, and were added. These helper methods make using commonly used styling simpler. Cake\Console\Exception\StopException was added.

was added. Shell::abort() was added to replace error() .

StopException Added Shell::_stop() and Shell::error() no longer call exit(). Instead they raise Cake\Console\Exception\StopException. If your shells/tasks are catching \Exception where these methods would have been called, those catch blocks will need to be updated so they don’t catch the StopException. By not calling exit() testing shells should be easier and require fewer mocks.

Helpers initialize() Helpers can now implement an initialize(array $config) hook method like other class types.