dhazelett/stack-whoops

Whoops的堆栈中间件,用于处理错误。

v1.0.2 2015-01-24 11:22 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:10:31 UTC


README

Whoops的堆栈中间件,用于处理错误。

警告!

此中间件没有测试。我只是想要一个适用于whoops+stack的中间件。 如果测试很重要,请随时发送PR

使用方法

use Silex\Application;
use Stack\Builder;

require_once '../app/config/bootstrap.php';

$app = new Application($config);

$stack = (new Builder)
    ->push('Saphire\Middleware\Whoops', [
        // STRING! name of the \Whoops\Handler\* to use
        'handler' => '\Whoops\Handler\PrettyPageHandler'
    ])
;

// Try it out
$app->get('/', function() {
    throw new \Exception('Oh No!');
});

$server = $stack->resolve($app);

$response = $server->handle($request)->send();

$server->terminate($request, $response);
MIT许可