What Is New in CakePHP 3.7
This version introduces several new features, improvements, and deprecations to prepare for the future framework evolution. The table below summarizes the key changes.
| Category | Key Changes |
|---|---|
| New Features | New Command base class, Mailer integration, FormHelper
template improvements. |
| Improvements | Better typehints, Cache engine enhancements, Database expression upgrades.
|
| Deprecated | Shell base class, several Helper and Table methods, old cache configs.
|
| Bug Fixes | Various fixes across ORM, View, and Console libraries. |
How does the new Command class change console work?
The new Cake\Console\Command class replaces the old Shell class for writing console
commands. This aligns CakePHP with modern PHP standards, using Symfony's Console component under the hood. In
practice, you should extend Command for any new console tasks.
The old Shell class is now deprecated. Existing shells will still work but will trigger deprecation
warnings. This change matters because it streamlines argument parsing and output formatting, making commands
more consistent and testable.
What mailer features were added?
CakePHP 3.7 integrates the Cake\Mailer\Mailer class directly into the framework core. Previously, it
was a separate plugin. This provides a structured, object-oriented way to define and send emails from your
application.
You can now create mailer classes that define email layouts, content, and transport configuration. It keeps email logic separate from your controllers and models, which is a cleaner approach for complex applications.
Are there template rendering updates?
Yes, the FormHelper received updates to its template system. New template methods like
create() and end() provide more flexibility. The helper now uses the
Templater interface consistently.
These changes allow for easier customization of form HTML output. You can override templates per helper instance, which is useful for large projects with multiple form styles.
What database expressions are improved?
The QueryExpression::add() method now accepts an optional third argument for defining the expression
type. This improves the ability to build complex SQL conditions programmatically and safely.
It helps the ORM generate more accurate SQL, especially when using nested conditions or custom expression objects. This is a low-level improvement that makes building advanced queries more reliable.
Which deprecated items should I act on first?
Focus on deprecations in code you actively maintain. The old Shell class and related base classes
are top priorities for console applications. Also, update any cache configurations using the old
Cache::config() method to use Cache::setConfig() instead.
Check uses of deprecated Table methods like addBehavior() and hasField().
The framework will guide you with warnings, but addressing these early reduces upgrade effort for the next major
version.
FAQ
Is CakePHP 3.7 a major breaking change release?
No, it's a feature release with added
functionality and deprecations. It maintains backward compatibility, but deprecated features will trigger
warnings. You should test your application and address deprecations to prepare for CakePHP 4.0.
Do I have to rewrite all my console shells immediately?
No, existing shells continue to work
but will show deprecation notices. You should plan to migrate them to the new Command class for new
development or when you refactor that part of your codebase.
How do I start using the new Mailer class?
Create a new class extending
Cake\Mailer\Mailer. Define your email methods and configurations there, then call it from your
controllers or services. Refer to the official documentation for detailed examples.
What's the deal with the Cache::config() deprecation?
The method Cache::config()
is deprecated in favor of Cache::setConfig(). This change aligns with naming conventions used
elsewhere in the framework. Update your calls to avoid future breakage.
Are typehint improvements going to break my plugins?
They might, if your plugin overrides
core methods and doesn't match the updated signatures. Check your plugin code against the new method signatures
in the framework, especially in Database and ORM layers, and adjust accordingly.