-
Improvement
-
Resolution: Deferred
-
Minor
-
None
-
4.4
As part of the Web Service work we're hoping to use Dependency Injection to simplify routing.
This issue is about adding that DI.
The proposal is to use php-di (https://php-di.org) and to configure it via a \core\container with auto-wiring enabled.
Hooks can be registered to add additional non-auto-wired classes.
The presence of DI in Moodle will allow the router proposed for use in the Web Services changes to add any required dependencies with minimal configuration.
DI will also be of great value for simplification of unit tests, especially with regards tooling such as Guzzle. An example of this usage can be found here: https://github.com/andrewnicols/moodle/blob/6a26ba5ec82c1a1250cd3ee2fa972fdd6f2ebd39/lib/tests/container_test.php#L70-L109
- will be (partly) resolved by
-
MDL-80072 Move format_* methods into new \core\formatting class and prep for new WS
-
- Closed
-