Created
February 13, 2020 15:51
-
-
Save Yrwein/dce2c81c3ac9df5c3a8d0b92211ba8c3 to your computer and use it in GitHub Desktop.
POC for stackoverflow.com/questions/60169581
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Psr\Http\Message\ServerRequestInterface as Request; | |
use \Psr\Http\Message\ResponseInterface as Response; | |
use \Psr\Container\ContainerInterface; | |
require './vendor/autoload.php'; | |
class TypeHintTestController { | |
private $container; | |
public function __construct(ContainerInterface $container) { | |
$this->container = $container; | |
} | |
public function index(Request $request, Response $response, array $args) { | |
$response->getBody()->write("From: " . get_class($this->container)); | |
return $response; | |
} | |
} | |
$app = new \Slim\App; | |
$app->get('/', '\TypeHintTestController:index'); | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it works, thank you‼