Container resolution by fully-qualified class names


Is it possible to grab request and response objects from the container using its fully-qualified class name (\Psr\Http\Message\RequestInterface::class)?
Whats the best way to achieve this? I have implemented auto-wiring resolution and this would be great.

i could just get request and response and reinsert them again in the container but… is there a better way?


you could do something like

$container = $app->getContainer();
$container[\Psr\Http\Message\RequestInterface::class] = function($c) {
return $c['request];