From be0ac22294fa302abe984b72ae8db9ddb3d75e82 Mon Sep 17 00:00:00 2001 From: Vincent Klaiber Date: Fri, 10 Apr 2015 15:04:16 +0200 Subject: [PATCH] Add whoops debugger. --- composer.json | 4 ++++ wp-content/themes/boilerplate/config/app.php | 13 +++++++++++ .../boilerplate/library/modules/debug.php | 22 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 wp-content/themes/boilerplate/library/modules/debug.php diff --git a/composer.json b/composer.json index 1eb49a30..9fa8d257 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,10 @@ "wpackagist-plugin/tiny-compress-images": "~1.0", "wpackagist-plugin/wp-sweep": "~1.0" }, + "require-dev": { + "fabpot/php-cs-fixer": "~2.0@dev", + "filp/whoops": "~1.0" + }, "extra": { "installer-paths": { "wp-content/plugins/{$name}": [ diff --git a/wp-content/themes/boilerplate/config/app.php b/wp-content/themes/boilerplate/config/app.php index b58e6e50..060dd9ff 100644 --- a/wp-content/themes/boilerplate/config/app.php +++ b/wp-content/themes/boilerplate/config/app.php @@ -2,6 +2,19 @@ return [ + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ + + 'debug' => getenv('APP_DEBUG'), + /* |-------------------------------------------------------------------------- | GZIP diff --git a/wp-content/themes/boilerplate/library/modules/debug.php b/wp-content/themes/boilerplate/library/modules/debug.php new file mode 100644 index 00000000..546addd0 --- /dev/null +++ b/wp-content/themes/boilerplate/library/modules/debug.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Whoops\Handler\PrettyPageHandler; +use Whoops\Run as Whoops; + +/** + * Register the Whoops debug handler. + */ +if (config('app.debug', false)) { + $whoops = new Whoops; + $whoops->pushHandler(new PrettyPageHandler); + $whoops->register(); +}