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') );