config.md 846 B

Runtime Configuration

Contents

The Basics

Sometimes you may need to get and set configuration options at runtime. For this you'll use the Config class, which utilizes Laravel's "dot" syntax for accessing configuration files and items.

Retrieving Options

Retrieve a configuration option:

$value = Config::get('application.url');

Return a default value if the option doesn't exist:

$value = Config::get('application.timezone', 'UTC');

Retrieve an entire configuration array:

$options = Config::get('database');

Setting Options

Set a configuration option:

Config::set('cache.driver', 'apc');