Simple App

Slim framework examples

How to start?

Just use Slim "Hello world":

use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require 'vendor/autoload.php';

$app = new \TiSuit\Core\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
    $name = $request->getAttribute('name');
    $response->getBody()->write("Hello, $name");

    return $response;

How to use magic?

You need to pass path to your config folder in App constructor (like slim settings, man:, example:

$config = [
    'config_dir' => __DIR__.'/config',
    'settings' => [
        'displayErrorDetails' => true,

        'logger' => [
            'name' => 'slim-app',
            'level' => Monolog\Logger::DEBUG,
            'path' => __DIR__ . '/../logs/app.log',
$app = new \TiSuit\Core\App($config);

And now, magic!

$root = new \TiSuit\Core\Root($app->getContainer());
echo $root->config('', 'production');

Place file app.php in __DIR__.'/config' folder (you passed it in App constructor, remember?):

<?php return [
    'site' => [
        'name' => 'TiSuit Example',
        'url' => '',
        'parent' => '',

And so on :)

Advanced usage

Feel the power of TiSuit!

Create new project with skeleton

Pre-made skeleton with docker and easy-to-use structure

composer create-project tisuit/skeleton

Configure routes


By default, route groups configured in app/config/routes/ dir. Each file is separate route group.

Example: if you want to create admin panel for your site, just place file app/config/routes/admin.php and add routes in it - all defined routes will have prefix

Install addtional packages

By default, skeleton has only Core module installed, if you want more - feel free to add any library you need, but TiSuit has some pre-configured "bundles", check them here:


If you want to generate HTML on backend side, just follow these steps and you will get Twig, sessions and flash messages pre-configured and integrated in Slim framework.

  • Install package:
composer require tisuit/html
  • Add configuration file html.php in your config dir (by default, app/config):


return [
    'template_path' => __DIR__.'/../views/',
    'cache_path' => __DIR__.'/../cache/views',
  • Add provider \TiSuit\Html\Provider into your suit.php config file (suit.providers)
  • Add middleware session_middleware into your suit.php config file (suit.middlewares)
  • Add session_start() on top of your app/public/index.php


Comming soon


TiSuit has predefined docker configs for quick start. You need to have Docker CE on your target machine (laptop,server,etc.) to run it


Run for development

or just for test

docker run -it -p 80:8080 -v `pwd`:/var/www tico/tisuit

Build production-ready image

  • Edit Dockerfile to add required for you packages and configs
  • Buld it via docker build .

Best way to do this with CI, we recommend GitLab CI.