PHP code example of icosillion / slim-controllers

1. Go to this page and download the library: Download icosillion/slim-controllers library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

icosillion / slim-controllers example snippets




use Slim\App;

$app = new App();

$app->group('/', function () use ($app) {
    $controller = new RootController($app);

    $app->get('', $controller('index'));
});

$app->run();



use Icosillion\SlimControllers\Controller;
use Slim\Http\Request;
use Slim\Http\Response;

class RootController extends Controller
{
    public function index(Request $request, Response $response, array $args)
    {
        $response->getBody()->write('Hello World!');

        return $response;
    }
}