Review main Abandoned

56092[WIP][POC][FEATURE] PHP-DI based Dependency Injection

Benjamin Franzke CR 0 V 0 Hard +648 −191 updated 09/25/18, 14:03

Commit message

Showcase
 * Frontend/Backend/Install/CLI application initialiation
   through the container
 * Middleware's fetched from the container (by the MiddlewarDispatcher)
   * Example: RedirectHandler Middleware (including dependencies)
 * Backend route handlers fetched from the container
   * Example: InfoModuleController (including dependencies)
 * Configuration through the container
   * Example: frontend/backend middlewares are resolved inside
     the container. The final list can be injected into the class that
     needs that information

Features
 * Adds support for TYPO3 flavored LoggerAwareInterface custom
   logger injection (dynamic logger per class) on top of
   PHP-DI (making use of PHP-DI's delegate/wrapper container feature)

TODO:
 * Add backward compatibility support falling back to
   GeneralUtility::makeInstance   for missing dependencies (left out
   by intent to show that dependency injection actually works)
 * Better integrate the compiled container cache into the TYPO3
   caching framework (missing API in PHP-DI)
 * …

Drawbacks (major blockers):
 * PHP-DI does not support injection of optional (Bar $bar = null)
   parameters http://php-di.org/change-log.html#42
   That means we cannot add backwards compatibiliy support
   in the constructor (it would _always_ use the fallback)

composer require php-di/php-di

Review

  • Code review CR 0

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V 0

    Imported before Forger kept the single votes, the next import adds them.

Files 21