Hi, I was only looking for a fairly simple framework for PHP. Well, I decided to try ‘SLIM’. Right now I’m not sure it was the right choice.
I installed it with composer and everything went well until the first example in the documentation
<?php
use Slim\Factory\AppFactory;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
require __DIR__ . '/../vendor/autoload.php';
$app = AppFactory::create();
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write('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();
and I’ve got immidiately
Fatal error: Uncaught Slim\Exception\HttpNotFoundException:
Not found. in /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:91
Stack trace:
#0 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/Routing/RouteRunner.php(72): Slim\Middleware\RoutingMiddleware->performRouting(Object(GuzzleHttp\Psr7\ServerRequest))
#1 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\Routing\RouteRunner->handle(Object(GuzzleHttp\Psr7\ServerRequest))
#2 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/App.php(215): Slim\MiddlewareDispatcher->handle(Object(GuzzleHttp\Psr7\ServerRequest))
#3 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/App.php(199): Slim\App->handle(Object(GuzzleHttp\Psr7\ServerRequest))
#4 /home/zbigi/domains/mai.grin.net.pl/public_html/index.php(15): Slim\App->run()
#5 {main} thrown in /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php on line 91
ok, read forums, make change in .httacces and went to the second example with before and after middelware and promptly got next error
Fatal error: Uncaught Slim\Exception\HttpNotFoundException: Not found. in /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:91 Stack trace: \t
#0 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/Routing/RouteRunner.php(72): Slim\Middleware\RoutingMiddleware->performRouting(Object(GuzzleHttp\Psr7\ServerRequest)) \t
#1 /home/zbigi/domains/mai.grin.net.pl/public_html/index.php(12): Slim\Routing\RouteRunner->handle(Object(GuzzleHttp\Psr7\ServerRequest)) \t
#2 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): {closure}(Object(GuzzleHttp\Psr7\ServerRequest), Object(Slim\Routing\RouteRunner)) \t
#3 /home/zbigi/domains/mai.grin.net.pl/public_html/index.php(22): class@anonymous->handle(Object(GuzzleHttp\Psr7\ServerRequest))
#4 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): {closure}(Object(GuzzleHttp\Psr7\ServerRequest), Object(class@anonymous))
5 /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/Middlewa in /home/zbigi/domains/mai.grin.net.pl/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php on line 91
I have a question, will it be like this all the time and each step has a thousand errors? Is it better to quit and look for something more elaborate.