di icon indicating copy to clipboard operation
di copied to clipboard

[RFC] Support lazy services via ocramius/proxy-manager

Open BoShurik opened this issue 4 years ago • 3 comments

Support lazy services via ocramius/proxy-manager

May be useful for view injections to initialize service only on usage

BoShurik avatar Nov 23 '20 14:11 BoShurik

We have https://github.com/yiisoft/proxy and https://github.com/yiisoft/container-proxy btw.

samdark avatar Nov 23 '20 14:11 samdark

As I understand those packages don't provide lazy loading but only decoration

BoShurik avatar Nov 25 '20 15:11 BoShurik

The feature would be useful and will likely improve overall performance (not entirely sure about it).

Some references:

  • https://symfony.com/doc/current/service_container/lazy_services.html
  • https://php-di.org/doc/lazy-injection.html
  • https://docs.laminas.dev/laminas-servicemanager/lazy-services/

samdark avatar Jan 28 '21 13:01 samdark