How to Enable and Disable Debug Mode in Laravel?

26-Nov-2022

.

Admin

How to Enable and Disable Debug Mode in Laravel?

Hi Developer,

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

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 the 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