25 public function register(Application $app)
28 $app[
'whoops.error_page_handler'] = $app->share(
function () {
29 if (PHP_SAPI ===
'cli') {
41 $app[
'whoops.silex_info_handler'] = $app->protect(
function () use ($app) {
44 $request = $app[
'request'];
52 $errorPageHandler = $app[
"whoops.error_page_handler"];
58 $errorPageHandler->addDataTable(
'Silex Application', array(
59 'Charset' => $app[
'charset'],
60 'Locale' => $app[
'locale'],
61 'Route Class' => $app[
'route_class'],
62 'Dispatcher Class' => $app[
'dispatcher_class'],
63 'Application Class' => get_class($app),
67 $errorPageHandler->addDataTable(
'Silex Application (Request)', array(
68 'URI' => $request->getUri(),
69 'Request URI' => $request->getRequestUri(),
70 'Path Info' => $request->getPathInfo(),
71 'Query String' => $request->getQueryString() ?:
'<none>',
72 'HTTP Method' => $request->getMethod(),
73 'Script Name' => $request->getScriptName(),
74 'Base Path' => $request->getBasePath(),
75 'Base URL' => $request->getBaseUrl(),
76 'Scheme' => $request->getScheme(),
77 'Port' => $request->getPort(),
78 'Host' => $request->getHost(),
83 $app[
'whoops'] = $app->share(
function () use ($app) {
85 $run->allowQuit(
false);
86 $run->pushHandler($app[
'whoops.error_page_handler']);
87 $run->pushHandler($app[
'whoops.silex_info_handler']);
91 $app->error(
function ($e) use ($app) {
95 $app[
'whoops']->$method($e);
96 $response = ob_get_clean();
97 $code = $e instanceof HttpException ? $e->getStatusCode() : 500;
99 return new Response($response,
$code);
102 $app[
'whoops']->register();
108 public function boot(Application $app)
Handler outputing plaintext error messages.
Whoops - php errors for cool kids.
A Whoops error handler that delegates calls on it self to another handler that is created only in the...