Enable and Disable Debug Mode 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 a good debugger to help the developer identify problems before going to production.

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

Enable/Disable Debug Mode In Laravel

To change Laravel debug mode, you need to modify the .env file in the root directory of the application. There is a variable APP_DEBUG which will store the current status of debug mode. By default it’s True.

Refer below code


To disable it just change the APP_DEBUG value to false like the below :


Enable or Disable Debug Mode Using Application Configuration

In Laravel, you can also disable or enable debug mode using a 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),