adamquaile/slimstack

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
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

This package is auto-updated.

Last update: 2021-09-25 00:14:40 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();