talesoft/tale-router

A router middleware for the Tale Runtime

0.1 2016-02-29 23:25 UTC

This package is auto-updated.

Last update: 2024-11-10 08:06:05 UTC


README

A Tale Framework Component

What is Tale Router?

Installation

Install via Composer

composer require "talesoft/tale-router:*"
composer install

Usage

use Tale\App;
use Tale\Router;

$app = new App();

$app->append(Router::class);

$router = $app->get(Router::class);
$router->get('/:controller?/:action?/:id?.:format?', function($request, $response, $next) {
    
    $controller = $request->getAttribute('controller', 'index');
    
    //Handle controller $controller
    
    return $next($request, $response);
});

$app->display();