Laravel Enable and Disable Debug Mode Example

Nov 26, 2022 . Admin



Hi Developer,

In this tutorial, we will demonstrate the laravel enable and disable debug mode example. It's a simple example of how to enable and disable debug mode in laravel. you can see enable and disable debug mode in laravel. I would like to share with you the enable and disable debug mode with laravel.

Laravel provides an APP_DEBUG flag in the .env file to handle application debug mode, the default is true and when you change to false it means you are disabling debug mode. Search the APP_DEBUG key in the .env file and change true to enable debug mode and false for disabling debug mode.

In this blog, you will learn how to enable and disable debug mode in Laravel. Having a debug mode is very important in order to show errors during local development.

Enable Debug Mode:

Go it .env file and APP_DEBUG variable value makes true for enable debug mode in laravel application.

.env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
Disable Debug Mode:

Set the APP_DEBUG environment variable value to false in the .env environment configuration file.

Go it .env file and APP_DEBUG variable value makes false for enable debug mode in laravel application.

.env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=false
APP_URL=http://localhost
Enable or Disable Mode from app.php:

Open the app.php file located in your config/app.php laravel project. Search for debug key and change true to enable debug mode and false for disabling debug mode default it will show false.

Go to the app.php file and debug the variable key value make true or false to enable debug mode in laravel application.

config/app.php : Enable Debug
'debug' => env('APP_DEBUG', true),
config/app.php : Disable Debug
'debug' => env('APP_DEBUG', false),

I hope it can help you...

#Laravel