Tengo el siguiente codigocódigo. Estoy usando Slim 4.2Slim 4.2
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
require __DIR__ . '../vendor/autoload.php';
//Cuando ocurra un error en nuestra api
$c = new \Slim\Container(); //Create Your container
//Override the default Not Found Handler before creating App
$c['notFoundHandler'] = function ($c) {
return function ($request, $response) use ($c) {
return $response->withStatus(404)
->withHeader('Content-Type', 'text/html')
->write('Page not found');
};
};
//Create Slim
$app = new \Slim\App($c);
$app->get("/",function (Request $request, Response $response)
{
$response->getBody()->write("El api esta corriendo");
return $response;
});
$app->run();
Me sale el siguinte error:PHP Fatalsiguiente error: Uncaught Error: Class 'Slim\Container' not found. Leí
PHP Fatal error: Uncaught Error: Class 'Slim\Container' not found.
Leí la documentación y usa exactamente la misma forma de llamar al container.