I do not understand, for example I'm using php-di container, I have ClassA and ClassB, both of them are implements Intreface1 And I'm creating objects of this two classes thru DI
Now when I'm injecting ClassA to the constructor I need inject exactly this class, which crate a dependency of this classA, not an Intreface1
Can I somehow say that this particular ClassA should implement intrefeca1 ? In docs of PHP-DI I found
// mapping an interface to an implementation
'LoggerInterface' => DI\create('MyLogger'),
But I do not understand how it works, LoggerIntreace it's just a string which maps this text to to the object
You can inject "by interface"
example with monolog and php-di, you say :
and now in your constructor, you can inject