From ac06718b9d1243ddb5394c50c820099cb7d21dde Mon Sep 17 00:00:00 2001 From: Vallabh Kansagara Date: Fri, 25 May 2018 19:59:16 +0530 Subject: [PATCH] Updating debug mode and it's env file. Signed-off-by: Vallabh Kansagara --- README.md | 9 ++++++++- src/Http/Middleware/AfterMiddleware.php | 11 ++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 92cbe79..49711e3 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,16 @@ protected $middleware = [ Add your target environment into `.env` ~~~bash - VRKANSAGARA_COMPRESS_ENVIRONMENT='prod,testing,dev' + VRKANSAGARA_COMPRESS_ENVIRONMENT='prod,testing,dev,local' ~~~ + +If you want to see how much you compress on each page, set bellow line in `.env` +~~~bash + VRKANSAGARA_COMPRESS_DEBUG=0 +~~~ + + ### Display usage on each page. Set `$debug = 1;` in `AfterMiddleware.php` diff --git a/src/Http/Middleware/AfterMiddleware.php b/src/Http/Middleware/AfterMiddleware.php index 584f149..d7dd54c 100644 --- a/src/Http/Middleware/AfterMiddleware.php +++ b/src/Http/Middleware/AfterMiddleware.php @@ -26,11 +26,12 @@ class AfterMiddleware public function handle($request, Closure $next) { - $isDebug = isset(getenv('VRKANSAGARA_COMPRESS_DEBUG')) - && ! empty(getenv('VRKANSAGARA_COMPRESS_DEBUG')) - getenv('VRKANSAGARA_COMPRESS_DEBUG') - : 0; - + $isDebug = null !== getenv('VRKANSAGARA_COMPRESS_DEBUG') + ? getenv('VRKANSAGARA_COMPRESS_DEBUG') + : 0; + if ($isDebug) { + $this->debug = 1; + } $targetEnvironment = explode( ',', getenv('VRKANSAGARA_COMPRESS_ENVIRONMENT') );