Hello Friends đź‘‹,

Welcome To Infinitbility! ❤️

This tutorial help you to enable and disable debug mode in laravel, here you will get two ways to enable and disable debug mode in laravel.

Laravel provide app debug mode feature for check errors and in your application code, it help us to know what is a error and where it is? but some time we want disable debug mode because it’s reveal credentials mainly in production and in stage environment.

Now we are going to learn how we change app debug mode in laravel and solution work

What is debug mode in laravel?

When your application is in debug mode, detailed error messages with stack traces will be shown on every error that occurs within your application. If disabled, a simple generic error page is shown.

Enable or disable debug mode using .env file

Laravel provide 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=base64:3FwqSZXTAfscqdzahG1P553GEQQBMBj+ecRDUUAEtrY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

Enable ENV APP_DEBUG Example

APP_DEBUG=true

Disable ENV APP_DEBUG Example

APP_DEBUG=false

Enable or disable debug mode using config app.php

Open 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 disable debug mode default it will show false.


    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

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

Enable Config debug Example

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

Disable Config debug Example

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

Thanks for Reading…