ProxyManager LTS

Long-term-support fork of ocramius/proxy-manager for generating PHP lazy-loading and virtual proxies

Library
Composer
vv1.0.19
1,208stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
47/100Fair
Development Activity0
Maintenance32
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
68/100Good
Architecture82
Code Quality80
Innovation50
Learning Curve60

friendsofphp/proxy-manager-lts is a maintained fork of the widely-used ocramius/proxy-manager library, created to keep proxy-generation support alive across a wider range of PHP versions after the original became largely unmaintained. It generates virtual proxies, lazy-loading proxies, and other AOP-style proxy objects for PHP classes at runtime, and is used internally by major frameworks such as Symfony (via symfony/dependency-injection lazy services) and Doctrine ORM for lazy entity loading. It ships as a drop-in replace for ocramius/proxy-manager in Composer, so existing code depending on the original package continues to work unmodified.

What You Get

  • Runtime code generation for virtual proxies, lazy-loading proxies, and null object proxies via ProxyGenerator classes
  • A Configuration class controlling proxy autoloading, caching, and generation strategy
  • Multiple GeneratorStrategy implementations (eval-based, file-writer-based) for different proxy-caching needs
  • Drop-in Composer compatibility with ocramius/proxy-manager via the replace directive, requiring no code changes to adopt
  • Continued support for PHP >=7.1, avoiding forced upgrades for projects still on older PHP versions

Common Use Cases

  • Powering Doctrine ORM’s lazy entity loading, where proxy objects defer database fetches until a property is accessed
  • Enabling Symfony’s lazy services feature, where a service’s real constructor only runs on first method call
  • Building custom AOP-style proxies for logging, caching, or access control around arbitrary PHP classes
  • Keeping legacy applications on older, unmaintained PHP versions working with modern DI containers that expect proxy-manager

Under The Hood

Architecture - The library’s core is a proxy-generation pipeline under src/ProxyManager/: ProxyGenerator/ classes build the AST/source for each proxy type (virtual, lazy-loading, ghost, etc.), Generator/ and GeneratorStrategy/ handle turning that into loadable PHP code (via eval or a file-writer strategy), FileLocator/ and Autoloader/ manage locating and autoloading generated proxy classes, and Signature/ computes cache-invalidation signatures so regenerated proxies match the source class shape. Tech Stack - PHP >=7.1 with laminas/laminas-code (for AST-level code generation) and symfony/filesystem as runtime dependencies, managed via Composer with minimum-stability: dev reflecting its incremental-fork nature, and symfony/phpunit-bridge for testing. Code Quality - The tests/ProxyManagerTest/ directory mirrors the src/ structure closely (Signature/, FileLocator/, ProxyGenerator/, Generator/, GeneratorStrategy/, Factory/, Autoloader/, plus a Functional/ suite for end-to-end proxy generation), indicating deliberate per-component coverage inherited from the original well-tested upstream project. API Design - As a conservative fork, the public API intentionally mirrors ocramius/proxy-manager exactly (same ProxyManager\ namespace, same Configuration/Factory classes) so downstream consumers like Symfony and Doctrine require zero code changes — the value here is entirely in maintenance continuity, not API redesign.

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