What the Framework

WTF Framework is a functional abstraction over Slim Framework.

As WTF has backward compatibility with Slim and does not break or change any of Slim concepts, you have to be familiar with Slim Framework. If not - read Slim docs first.

Vision

WTF vision is to enable rapid development by defining bare minimum functionality and remaning as clean and lightweight as the Slim is.

Let’s check the following example:

WTF FrameworkSlim Framework
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require 'vendor/autoload.php';

$app = new \Wtf\App;
$app->get('/hello/{name}', function (Request $request, Response $response, array $args) {
    $name = $args['name'];
    $response->getBody()->write("Hello, $name");

    return $response;
});
$app->run();
                
<?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, array $args) {
    $name = $args['name'];
    $response->getBody()->write("Hello, $name");

    return $response;
});
$app->run();
                

Looks similar, huh?

The difference

Basicly any plugin, library, etc. (3rdParty) is integrated with WTF trhough the Service Provider layer.

There are serveral service providers available:

  1. wtf/orm - ORM library based on medoo with phinx migrations and seeds
  2. wtf/html - template library based on Twig which includes flash messages, CSRF and many other useful stuff
  3. wtf/rest - helper toolset for building REST APIs, eg: jwt integration
  4. wtf/auth - authorization and authentication library which provides flexible way to define and use:
      • JWT auth
      • Session auth
      • Cookie auth
      • Social auth (coming soon)
      • Role-Based Access Control
      • Password manipulation

> Quick start