PHP Fatal error: Uncaught RuntimeException: Could not detect any PSR-17 ResponseFactory implementations. Please install a supported implementation in order to use AppFactory::create(). See https://github.com/slimphp/Slim/blob/4.x/README.md for a list of supported implementations. in C:\Users\myproject\vendor\slim\slim\Slim\Factory\AppFactory.php:182
Stack trace:
PHP Fatal error: Uncaught RuntimeException: Could not detect any PSR-17 ResponseFactory implementations. Please install a supported implementation in order to use
AppFactory::create()
. See https://github.com/slimphp/Slim/blob/4.x/README.md for a list of supported implementations. in C:\Users\myproject\vendor\slim\slim\Slim\Factory\AppFactory.php:182 Stack trace:0 C:\Users\myproject\vendor\slim\slim\Slim\Factory\AppFactory.php(93): Slim\Factory\AppFactory::determineResponseFactory()
1 C:\Users\myproject\public\index.php(9): Slim\Factory\AppFactory::create()
2 {main}
thrown in C:\Usersmyproject\vendor\slim\slim\Slim\Factory\AppFactory.php on line 182
my index.php
<?php use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory;
require DIR . '/../vendor/autoload.php';
// Instantiate App $app = AppFactory::create();
// Add error middleware $app->addErrorMiddleware(true, true, true);
// Add routes $app->get('/', function (Request $request, Response $response) { $response->getBody()->write('Try /hello/world'); return $response; });
$app->get('/hello/{name}', function (Request $request, Response $response, $args) { $name = $args['name']; $response->getBody()->write("Hello, $name"); return $response; });
$app->run();