adamquaile/slimstack

There is no license information available for the latest version (dev-master) of this package.

Very minimal PHP front-controller class

dev-master 2013-12-17 20:26 UTC

README

Tiny front-controller offering very small and light routing.

  • This is built for very specific purposes. You might consider similar systems such as Silex or Slim which offer more features and flexibility. *

Getting the code.

This can be installed in your project with composer require adamquaile/slimstack

Creating simple front-controllers / bootstrap files

<?php

// Auto-loading thanks to PSR/composer
require __DIR__ . '/../vendor/autoload.php';

$app = new \AdamQuaile\SlimStack\App();

// Simple dummy GET request
$app->get('/test/:name', function($name) {

    $data = [
        "name" => $name,
        "ids" => [1,2,3]
    ];

    $response = new Response(json_encode($data));
    return $response;

});

$app->run();