The configuration of the Laravel application offers by means of the ‘config‘ subdirectory, which holds the whole configuration file associated to our Laravel project. This subdirectory retains files like a database, mailing, services, and session-based configuration files with an extension of .config. The configuration of the Laravel project allows you to define configuration per-environment. In this tutorial, we’ll study concerning the totally different configurations and the way the basic setup is done in Laravel.
Configure Basic in Laravel
If we’re new to Laravel, then we need to know that you’ve got the availability to create configuration files for the Laravel application. After installing Laravel, it’s good to carry out the permission writing to your storage directory together with the bootstrap/cache.
Next, it’s a must to do is, generating the application key for session securing and encrypted data keys also. In case, the root directory does not have the .env file, in that case, we’ll have to rename the file .env.example to .env and run the command talked about below the place we have put in the Laravel:
php artisan key: generate
We can see within the .env file the newly generated key. Moreover, it’s also possible to configure the time zone as well as a locale within the config/app.php file of our project.
'env' => env('APP_ENV', 'production'),
config(['app.timezone' => 'Asia/Kolkata']);
Laravel permits us to run an software for diverse environments like testing, production, and so forth. For configuring your software’s environment, we have to the .env file, which is within the root directory of the project. When we install composer for Laravel, then this file will get generated or created automatically by the composer itself, however when we do not install, then need to rename the particular file with the name .env.example to .env only.
Configuring the Database
We can configure the database to our software utilizing the config/database.php file of our project. Setting the configuration constraint utilized by various databases may also be executed, and furthermore, Laravel also allowed us to make use of the default one as nicely.
Websites are repeatedly modified. As s a developer for this, it’s a must to put your web site in maintenance mode. In this superior framework, it turns into simpler to do this through the use of two artisan commands. Let’s see the best way to use the instructions:
For beginning your project maintenance method, the next 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