Instead of having many config files scattered throughout the project, Laravel 11 simplify this process by removing many of these config files.
Instead, Laravel 11 update adopts a cascading configuration approach, where config options cascade down from higher-level settings to more specific ones. This means that instead of managing separate config files for different environments or components, you can set global defaults and override them.
The '.env file', used for environment-specific configuration, has been expanded to include all the options you want to set for your application. This consolidation simplifies configuration settings management, as everything can now be centralized in the .env file.
Laravel 11 update announces a new 'config:publish' command. This command allows developers to selectively bring back any config options they want to customize or override from the streamlined configuration setup. With the cascade feature, developers can quickly eliminate options that aren't needed, keeping the configuration straightforward.
Example
If you need to bring back specific config files for customization, you can use the config:publish command. For example, if you want to customize the mail configuration:
php artisan config:publish mail
This command will return the mail configuration file (config/mail.php) to your project, allowing you to make specific adjustments.
Key points
- A single .env file makes managing settings easier and eliminates scattered files.
- Cascading defaults minimize the need for extensive configuration and streamlining setup.
- The publishing option allows customization if needed while maintaining cascading benefits.