run() public method

Calls route and outputs it to STDOUT
public run ( )
コード例 #1
0
ファイル: index.php プロジェクト: andrelotto/Ham
<?php

require '../ham/ham.php';
$beans = new Ham('beans');
$beans->route('/', function ($app) {
    return "Beans home.";
});
$beans->route('/baked', function ($app) {
    return "Yum!";
});
$app = new Ham('example', false, 'logs/' . date('Y-m-d') . '.txt');
$app->route('/', function ($app) {
    $app->logger->log('Home requested');
    return "Home.";
});
$app->route('/', function ($app) {
    return "Home.";
});
$app->route('/hello/<string>', function ($app, $name) {
    return $app->render('hello.html', array('name' => $name));
});
$app->route('/beans', $beans);
$app->run();
コード例 #2
0
});
// klein
$klein = new \Klein\Klein();
$klein->respond('GET', '/hello', function () {
    return 'hello';
});
$bench->iterate('klein', function () use($klein) {
    $klein->dispatch();
});
// ham
$_SERVER['REQUEST_URI'] = '/hello';
$ham = new Ham('example');
$ham->route('/hello', function ($ham) {
});
$bench->iterate('ham', function () use($ham) {
    $ham->run();
});
// aura
$aura = (require 'aura/aura/scripts/instance.php');
$aura->add('hello', '/hello');
$bench->iterate('aura', function () use($aura) {
    $route = $aura->match('/hello', $_SERVER);
});
// Symfony
$routes = new RouteCollection();
$routes->add('hello', new Route('/hello', array('controller' => 'foo', 'action' => 'bar')));
$bench->iterate('symfony/routing', function () use($routes) {
    $context = new RequestContext();
    $context->fromRequest(Request::createFromGlobals());
    $matcher = new UrlMatcher($routes, $context);
    $route = $matcher->match('/hello');