Thursday, December 26, 2024
Google search engine
HomeLanguagesEnable and Disable Debug Mode in Laravel

Enable and Disable Debug Mode in Laravel

Enable and disable debug mode in laravel apps; In this tutorial, you will learn how to enable and disable debug mode in laravel apps.

There are only two options to enable or disable debug mode in laravel app. So, open app.php or .env file in laravel project. and find for debug key and change true to enable debug mode and false to disable debug mode default.

How to Enable and Disable Debug Mode in Laravel App

In the tutorial, you will learn 2 methods. With this, you can easily enable and disable debug mode in your laravel app. These are given below:

  • Method 1 – Enable or Disable Mode using .env File
  • Method 2 – Enable or Disable Mode using app.php

Method 1 – Enable or Disable Mode using .env File

Visit your project root directory and open the .env file. Then find for debug key and change true to enable debug mode and false for disabling debug mode default it will show false. is as follow:

Enable Debug

Laravel provides APP_DEBUG flag in .env file to handle application debug mode, default it true and when you change to false it means you are disabling debug mode.

Search APP_DEBUG key in .env file and change true to enable debug mode and false for disable debug mode.

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=single

Disable Debug

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

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=false
APP_URL=http://localhost

LOG_CHANNEL=single

Method 2 – Enable or Disable Mode using app.php

In this method, visit your project config directory and open the app. php file located in your config/app. And find for debug key and change true to enable debug mode and false for disabling debug mode default it will show false. is as follow:

Enable Debug

Set the APP_DEBUG environment variable value to true in the app.php file.

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

Disable Debug

Set the APP_DEBUG environment variable value to false in the app.php file.

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

Conclusion

That’s it, In this tutorial, you have learned how to enable and disable debug mode in laravel apps.

Recommended Laravel Tutorials

RELATED ARTICLES

Most Popular

Recent Comments