Use config('app.name') to retrieve settings and config(['app.debug' => true]) to set runtime overrides.
The config() helper accesses application configuration options defined in config/*.php files. You can also pass key-value arrays to override configurations dynamically during testing or request execution.
// Retrieve config value with fallback default
$appName = config('app.name', 'Laravel');
// Override config value dynamically at runtime
config(['services.stripe.key' => 'pk_test_12345']);
- Dot-notation syntax accesses nested configuration array keys
- Passing key-value arrays overrides configurations dynamically for current request
- Always use config() instead of env() outside config directory files
Related Tips
View all tips →Use config() Instead of env() in Application Code
Call env() only inside configuration files and use config() throughout your application code to prevent missing values when configuration is cached.
Monthly Log Rotation with Laravel 13.23
Laravel 13.23 adds a built-in monthly logging driver that rotates log files once per month instead of daily.