The configuration of the Laravel application deals through the 'config' subdirectory, which holds the entire configuration file related to your Laravel project. This subdirectory keeps files like a database, mailing, services, and session-based configuration files with an extension of .config. The configuration of the Laravel project permits you to define configuration per environment. This tutorial will teach you about the different configurations and how the basic setup is done in Laravel.
Configuring the Basic in Laravel Project
If you are new to Laravel, you should know that you can create a configuration file for the Laravel application. And after installing Laravel, you need to perform the permission writing for your storage directory along with the bootstrap/cache.
Next, you must generate the application key for session securing and encrypted data keys. In case the root directory doesn't have the .env file, in that case, you will have to rename the file .env.example to .env and run the command mentioned below where you've installed the Laravel:
php artisan key: generate
You can see in the .env file the newly generated key. In addition, it is possible to configure the locale time zone in your project's config/app.php file.
Configuring the Environment
Laravel allows us to run an application for diverse environments like testing, production, etc. You will need the .env file in the project's root directory to configure your application's environment. When you install the composer for Laravel, the composer generates or creates this file automatically. If you don't install it, then rename the specific file with the name .env.example to .env only.
Configuring the Database
You can configure the database for your application using the config/database.php file of your project. Setting the configuration constraint utilized by various databases can also be done, and Laravel also allowed us to use the default one.
Websites are regularly modified. As s a developer for this, you have to put your site in maintenance mode. In this advanced framework, it becomes easier to do that by using two artisan commands. Let's see how to use the commands:
For starting your project maintenance approach, the following command is required:
php artisan down
After changing the required stuff, when it is time to re-run your project, the following command is needed:
php artisan up