Closed kelunik closed 3 years ago
Yes. Feels a bit weird, suggestions welcome.
I'd like to use it in WordPress actions. Tiny Closures would be fine! Do anything heavy only when the hook is fired.
return function () {
return Injector::make($something);
};
⚠️ This is oversimplified.
Proxies are now very simple to create: https://github.com/amphp/injector/blob/d624cf8daddff38d05436d8c08f75f488f5b5f94/examples/proxy.php#L89-L91
The logic for the class above in the example might be moved to a separate repository to avoid the dependency on proxy-manager
.
/cc @overclokk
@kelunik Is it a factory that returns a Closure that instantiates the given class when executed?