Skip to content

Backwards Compatibility Guide

Ensuring that you can upgrade your applications easily and smoothly is important to us. That's why we only break compatibility at major release milestones. You might be familiar with semantic versioning, which is the general guideline we use on all CakePHP projects. In short, semantic versioning means that only major releases (such as 2.0, 3.0, 4.0) can break backwards compatibility. Minor releases (such as 2.1, 3.1, 3.2) may introduce new features, but are not allowed to break compatibility. Bug fix releases (such as 2.1.2, 3.0.1) do not add new features, but fix bugs or enhance performance only.

NOTE

CakePHP started following semantic versioning in 2.0.0. These rules do not apply to 1.x.

To clarify what changes you can expect in each release tier we have more detailed information for developers using CakePHP, and for developers working on CakePHP that helps set expectations of what can be done in minor releases. Major releases can have as many breaking changes as required.

Migration Guides

For each major and minor release, the CakePHP team will provide a migration guide. These guides explain the new features and any breaking changes that are in each release. They can be found in the Appendices section of the cookbook.

Using CakePHP

If you are building your application with CakePHP, the following guidelines explain the stability you can expect.

Interfaces

Outside of major releases, interfaces provided by CakePHP will not have any existing methods changed and new methods will not be added to any existing interfaces.

Classes

Classes provided by CakePHP can be constructed and have their public methods and properties used by application code and outside of major releases backwards compatibility is ensured.

NOTE

Some classes in CakePHP are marked with the @internal API doc tag. These classes are not stable and do not have any backwards compatibility promises.

In minor releases (3.x.0), new methods may be added to classes, and existing methods may have new arguments added. Any new arguments will have default values, but if you've overidden methods with a differing signature you may see errors. Methods that have new arguments added will be documented in the migration guide for that release.

The following table outlines several use cases and what compatibility you can expect from CakePHP:

If you...Backwards compatibility?
Typehint against the classYes
Create a new instanceYes
Extend the classYes
Access a public propertyYes
Call a public methodYes
Extend a class and...
Call a protected methodNo[^1]
Override a protected propertyNo[^2]
Override a protected methodNo[^3]
Access a protected propertyNo[^4]
Call a public methodYes
Override a public methodYes[^5]
Override a public propertyYes
Add a public propertyNo
Add a public methodNo
Add an argument
to an overridden methodNo[^6]
Add a default argument
to an existing methodYes

Working on CakePHP

If you are helping make CakePHP even better please keep the following guidelines in mind when adding/changing functionality:

In a minor release you can:

In a minor release can you...
Classes
Remove a classNo
Remove an interfaceNo
Remove a traitNo
Make finalNo
Make abstractNo
Change nameYes[^7]
Properties
Add a public propertyYes
Remove a public propertyNo
Add a protected propertyYes
Remove a protected propertyYes[^8]
Methods
Add a public methodYes
Remove a public methodNo
Add a protected methodYes
Move member to parent classYes
Remove a protected methodYes[^9]
Reduce visibilityNo
Change method nameYes[^10]
Add default value to
existing argumentNo
Add argument with
default valueYes
Add required argumentNo

[^1]: Your code may be broken by minor releases. Check the migration guide for details.

[^2]: Your code may be broken by minor releases. Check the migration guide for details.

[^3]: Your code may be broken by minor releases. Check the migration guide for details.

[^4]: Your code may be broken by minor releases. Check the migration guide for details.

[^5]: Your code may be broken by minor releases. Check the migration guide for details.

[^6]: Your code may be broken by minor releases. Check the migration guide for details.

[^7]: You can change a class/method name as long as the old name remains available. This is generally avoided unless renaming has significant benefit.

[^8]: Avoid whenever possible. Any removals need to be documented in the migration guide.

[^9]: Avoid whenever possible. Any removals need to be documented in the migration guide.

[^10]: You can change a class/method name as long as the old name remains available. This is generally avoided unless renaming has significant benefit.

Released under the MIT License.