Installation or Setup Slim framework
composer require slim/slim "^3.0"
Now you will have vendor directory in your project
Next Create Index.php in root folder and add following code
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require 'vendor/autoload.php';
$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
$name = $request->getAttribute('name');
$response->getBody()->write("Hello, $name");
return $response;
});
$app->run();
Then Run Project on Localhost and try with following command
Output
Hello any-thing