<?php
require_once __DIR__ . '/../vendor/autoload.php';
$router = new AltoRouter();
$router->map('GET|POST','/',
'App\TopController::index',
'home'
);
$match = $router->match();
if( is_array($match) && is_callable( $match['target'] ) ) {
$params = explode("::", $match['target']);
$action = new $params[0]();
call_user_func_array(array($action, $params[1]) , $match['params']);
} else {
header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
}
PHP
AltorouterでLaravel的なクラス名ルーティングをする方法 C0d3man52