Symfony ProxyManager Bridge

Discontinued bridge that generated lazy-loading proxy services for Symfony's DI container via ProxyManager.

Library
Composer
vv6.4.28
751stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
50/100Fair
Development Activity24
Maintenance48
Community48
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
54/100Fair
Architecture62
Code Quality60
Innovation40
Learning Curve55

Symfony ProxyManager Bridge wired ocramius/ProxyManager (via the FriendsOfPHP LTS fork) into Symfony’s DependencyInjection component so services marked lazy could be instantiated as lazy-loading proxies instead of eagerly at container build time. It provided both a runtime instantiator, generating proxy classes on the fly, and a ProxyDumper for compiling proxy code directly into the dumped container for production performance.

The package is officially discontinued: Symfony 6.2 introduced a native lazy-service mechanism that no longer requires ProxyManager, and 6.4 was the last version published. Its RuntimeInstantiator class triggers a deprecation notice on use. It remains documented here for projects still on older Symfony versions or investigating legacy DI configurations.

What You Get

  • RuntimeInstantiator for generating ProxyManager lazy-loading proxies on the fly (deprecated since 6.3)
  • ProxyDumper for compiling proxy classes directly into the dumped DI container
  • Internal ProxyGenerator and LazyLoadingFactoryTrait helpers shared by both instantiation paths
  • A working example of Symfony’s InstantiatorInterface/DumperInterface extension points for lazy services

Common Use Cases

  • Legacy Symfony applications (pre-6.2) still relying on ProxyManager-based lazy service loading
  • Migrating a codebase off this bridge onto Symfony’s native lazy-service support introduced in 6.2
  • Studying how Symfony’s DI container historically generated lazy proxies before the native implementation replaced it

Under The Hood

ArchitectureRuntimeInstantiator::instantiateProxy() reflects the target service class, builds an anonymous LazyLoadingValueHolderFactory subclass using LazyLoadingFactoryTrait, and hands it an initializer closure that calls the container’s real instantiator on first proxy access, then detaches the initializer. ProxyDumper mirrors this logic at compile time via ProxyGenerator, emitting equivalent PHP source so the compiled container needs no runtime code generation.

Tech Stack — PHP 8.1+, PSR-4 autoloaded under Symfony\Bridge\ProxyManager. Depends on friendsofphp/proxy-manager-lts (the community-maintained fork of the archived ocramius/ProxyManager) and symfony/dependency-injection.

Code Quality — Covered by PHPUnit tests (ContainerBuilderTest, PhpDumperTest, RuntimeInstantiatorTest) with fixture-based assertions comparing generated proxy PHP source against expected output. As a deprecated package, it receives no new feature work — only the deprecation notice added in 6.3.

API Design — The bridge conforms entirely to Symfony DI’s existing InstantiatorInterface/DumperInterface contracts, so integrating it required no bridge-specific API beyond registering it in container configuration — a pattern later superseded by lazy-service support built directly into symfony/dependency-injection itself, eliminating the need for a separate bridge package.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search