Could not detect any PSR-17 ResponseFactory implementations

Here is the code that I used and site url

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;

require __DIR__ . '/../vendor/autoload.php';

$app = AppFactory::create();

$app->get('/', function (Request $request, Response $response, $args) {
    $response->getBody()->write("Hello world!");
    return $response;



Take a quick look into the documentation: Step 3: Install a PSR-7 Implementation and ServerRequest Creator and it should be clear.

I also would mention that the URL like rest.php will not work, because the router expects a “pretty” URL. Read more: Slim 4 - Tutorial.