Laravel8 Tutorial - Laravel Configuration (Maintenance mode -503)

Last updated Jan 29, 2022

As its name implies, the config directory contains all the Laravel 8 application configuration files. In this directory, you will find different configuration files such as mail, applications, databases, services, etc.

In this chapter, we will look at primary and Laravel configurations in Laravel 8.

We are going to look at:

  • Basic Laravel configuration

  • Environmental configuration

  • Database configuration


1. Basic Laravel Configuration

After creating a new Laravel project, you need to set the write permissions for the Cache and the storage directory.

You will need to generate the key to secure the session and any other data which have been encrypted. However, this is primarily created automatically in the .env file in Laravel 8


Laravel Application configuration


In the .env file, you can also perform other basic configurations such as setting time and Locale zone:


2. Environmental Configuration

Laravel 8 provides a facility to run the application in various environments such as production, testing etc. It is possible to configure your application environment in the .env file in the root directory. However, you do not have to configure your application environment if you have installed your application using Composer.


3. Database Configuration

You can connect your database to your application by configuring your application from the config/database.php file. To do this, you should just set the configuration parameters used by databases, or you can opt to go for the default parameters

Laravel Application configuration


Caching of Configuration

To make application faster and increase the performance of the web application, it is important to cache the configuration values. To make the caching the configuration values we will use below command



Make Application in Maintenance Mode:

Some times we may require to update/manage the data/ server, to do this we can put the application in maintenance mode to tell the user application is under maintenance mode by throwing MaintenanceModeException with 503 status code.

To make application under maintenance mode we will run below command

php artisan down



Once we done with our maintenance/updations we can revert our application to running state by executes below command

php artisan down


Article Contributed By :