teknoo/bridge-phpdi-symfony
Bridges PHP-DI and Symfony, enabling Symfony applications to use PHP-DI’s dependency injection container for service definitions, autowiring, and container interoperability. Helpful for projects adopting PHP-DI or migrating DI setup while keeping Symfony conventions.
di_bridge.import aliasing Symfony services into PHP-DI, di_bridge.extensions plugin interface, compile-time export rules) is itself a product surface. A PM cares because these are the knobs that determine how much bespoke glue engineering must build and maintain, and whether third-party bundles can opt in.di_bridge.compilation_path) and optional APCu-backed definitions cache (di_bridge.enable_cache) map directly to cold-start latency, deploy artifact size, and "can this run in a container without APCu" questions — decisions that show up in SLOs and platform baselines.php-di/php-di ^7.1.1 constraints, plus a very small community footprint (single lead maintainer), feed into the support-matrix and vendor-risk register rather than into a feature backlog.Consider adoption when all of the following hold:
php-di/php-di ^7.1.1. You have CI capacity for the package's test requirements (Xdebug for coverage, APCu for cache tests).Look elsewhere when:
symfony/http-kernel, dependency-injection, config) and does not apply; do not treat it as a framework-agnostic PSR-11 utility.di_bridge.* configuration tree and the ExtensionInterface contract are effectively API you would be building on top of an unversioned-by-popularity project.For executives (one paragraph): We have a body of application code wired with PHP-DI and a strategic direction toward Symfony. The conventional choices are (a) a multi-quarter rewrite of all dependency wiring, or (b) maintaining a private fork of Symfony's kernel. This package offers a third option: a small, BSD-licensed bridge that runs PHP-DI definitions inside a standard Symfony kernel, so we migrate on Symfony's timeline while existing code keeps working. It is low-cost to trial and reversible — no fork, no vendor lock-in at the code level. The trade-off is maturity: the project is essentially single-maintainer with a negligible user base, so the recommendation is a time-boxed pilot with a pinned version and a documented exit path, not an organization-wide standard.
For engineering leadership: The bridge integrates at compile time — PHP-DI entries are exported into the Symfony container as factory-built services, with aliases, priorities, and Symfony parameter propagation handled declaratively via the di_bridge config. It implements PSR-11 for runtime interop and exposes an extension interface for our own conventions. It requires PHP 8.4+, Symfony 6.4.24+/7.4/8.1, and php-di/php-di ^7.1.1; APCu is optional and only needed for the definitions cache.
For the engineering team: Ask for one sprint to validate: (1) boot a real kernel with our largest definition set and measure container compile time and cold-start; (2) confirm our PHP/Symfony versions are inside the supported matrix; (3) assess upgrade exposure to the single maintainer — are we prepared to carry a patched fork? Decision rule: proceed to adoption only if the pilot shows a net reduction in migration effort versus a definition-by-definition port to native Symfony DI, and if we accept ownership of a contingency fork. Otherwise, default to native Symfony DI and treat this bridge as a tactical, time-boxed bridge — which is exactly what its name says it is.
How can I help you explore Laravel packages today?