Laravel Configuration
All of the configuration files for the
Laravel framework are stored in the config directory. Each option is
documented, so feel free to look through the files and get familiar with the
options available to you.
These configuration files allow you to
configure things like your database connection information, your mail server
information, as well as various other core configuration values such as your application
timezone and encryption key.
1. Environment Configuration
Laravel's default .env file contains some common configuration values that may differ based on whether your application is running locally or on a production web server. These values are then retrieved from various Laravel configuration files within the config directory using Laravel's env function.
2. Configuration Caching
To give your
application a speed boost, you should cache all of your configuration files
into a single file using the config:cache Artisan command. This will combine
all of the configuration options for your application into a single file which
can be quickly loaded by the framework.
3. Debug Mode
The debug option in
your config/app.php configuration file determines how much information about an
error is actually displayed to the user. By default, this option is set to
respect the value of the APP_DEBUG environment variable, which is stored in
your .env file.
For local development,
you should set the APP_DEBUG environment variable to true. In your
production environment, this value should always be false. If the variable is
set to true in production, you risk exposing sensitive configuration values to
your application's end users.
4. Maintenance Mode
Sometimes you may need to update some
configuration values or perform maintenance on your website. In such cases,
keeping it in maintenance mode, makes it easier for you. Such web
applications which are kept in maintenance mode, throw an exception
namely MaintenanceModeException with a status code of 503.
You can enable the maintenance mode on your Laravel web application using the following command –
Once you finish working on updates and other maintenance, you can disable the maintenance mode on your web application using following command –
For more resources check: Laravel.com
0 Response to "Laravel Configuration"
Post a Comment