I am working on a large-scale and long-lived CakePHP project which could benefit heavily from the use of a dependency injection container, both for testing purposes and to encourage the use of more decoupled/maintainable code.
However, I note from the CakePHP documentation that the DI container is currently marked as experimental (and has been for some time).
Is there a roadmap anywhere indicating if/when the DI container will leave experimental status, or whether any further API changes are expected/planned? Is it safe/recommended to use it now in a large production application, or should I wait until a later date?
Any info would be much appreciated!
we currently have no plans on changing the current DI Container API either in current CakePHP 4.x nor in CakePHP 5.x (no release date planned till now)
The current CakePHP 4.3 version already uses the latest
league/container version which also doesn’t seem to have any major changes planned in the near future.
So you are definitely encouraged to use the DI Container and its PHPUnit service mocking features.
I will talk with the team about that “unstable API” notice in the docs.
@KevinPfeifer - Many thanks for the quick reply, much appreciated! That’s great to hear.
Personally I have been using the DI Container since it has been released in CakePHP 4.2 (22 Dec. 2020) and it has been great ever since!
We have now removed that unstable notice from the docs as well.
@KevinPfeifer - Awesome, thanks