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. In this tutorial, you will learn 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 have to 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. Moreover, it is also possible to configure the time zone as well as a locale in the config/app.php file of your project.
Configuring the Environment
Laravel allows us to run an application for diverse environments like testing, production, etc. For configuring your application's environment, you will need the .env file in the project's root directory. When you install the composer for Laravel, this file is generated or created automatically by the composer. If you don't install, 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