Laravel

Laravel Config and Environment Variables

January 16, 2026 1 min read 17 views

Configuration management:

Access Config

$value = config('app.name');
$value = config('app.timezone', 'UTC');

Environment Variables

$debug = env('APP_DEBUG', false);

Custom Config File

// config/services.php
return [
    'stripe' => [
        'key' => env('STRIPE_KEY'),
    ],
];

Config Caching

php artisan config:cache
php artisan config:clear

Runtime Setting

config(['app.timezone' => 'Asia/Dubai']);
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!