Skip to content

Enabling Laravel APP_DEBUG dynamically in production environment

Notifications You must be signed in to change notification settings

Benjaminhu/laravel-app-debug-dynamic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic enable APP_DEBUG via COOKIE & IP

Installation

You can install the package via composer:

$ composer require benjaminhu/laravel-app-debug-dynamic

Usage

Simply register the newly created class in your (top of) middleware stack.

// app/Http/Kernel.php
class Kernel extends HttpKernel
{
    protected $middleware = [
        \Benjaminhu\LaravelAppDebugDynamic\AppDebugDynamicMiddleware::class,
        // ...
    ];
    // ...
}

Publish config:

$ php artisan vendor:publish --provider="Benjaminhu\LaravelAppDebugDynamic\AppDebugDynamicServiceProvider"

Setup .env (remember: in production mode alway set: APP_DEBUG=false!):

# ...
APP_DEBUG=false
APP_DEBUG_DYNAMIC_COOKIE_NAME=<CHOOSE COOKIE NAME>
APP_DEBUG_DYNAMIC_COOKIE_SECRET=<CHOOSE COOKIE SECRET>
# optional
# APP_DEBUG_DYNAMIC_ALLOWED_IPS=<LIST, OF, ALLOWED, IP, ADDRESSES>
# ...

Testing

$ composer test

About

Enabling Laravel APP_DEBUG dynamically in production environment

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages