enable disable debugging in laravel

Debugging is a helpful feature for developers to identify the causes of issues. Most of the modern application frameworks provide you the option to enable debug mode. Laravel also provides good debugger to help developer to identify problem before going to production.

But be careful with debug mode because if it's on in production server then it can reveal sensitive information about application and server.

Enable/Disable Debug Mode In Laravel

In order to change Laravel debug mode, you need to modify .env file in the root directory of application. There is variable APP_DEBUG which will stores current status of debug mode. By default it's True.

Refer below code

    
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:Pv58f27htTXJ0W4kUL7y8C4oMuDFtNHNgNI8YvCEoie=
APP_DEBUG=true
APP_URL=http://test.test
    

To disable it just change APP_DEBUG value false like below :

    
APP_DEBUG=false
    

Enable or Disable Debug Mode Using Application Configuration

In Laravel, you can also disable or enable debug mode using configuration file. Open the app.php file located in your config/app.php Laravel project.

To Enable Debug

    
'debug' => (bool) env('APP_DEBUG', true),
    

To Disable Debug

    
'debug' => (bool) env('APP_DEBUG', false),
    

Share your thoughts

Ask anything about this examples