Answer the question
In order to leave comments, you need to log in
Can a DI container work like this?
$sys = new Container();
Next, the class reads the config, where it is written how to create an object, its constructor arguments, etc.
The first time you call a service like
$sys->get(Request::class);
//или по псевдониму как $sys->request
$sys->notInitService = function(Container $c) {
return new NewService($c->get(ServiceArg::class));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question