config.md 846 Bytes
Newer Older
Taylor Otwell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
# Runtime Configuration

## Contents

- [The Basics](#the-basics)
- [Retrieving Options](#retrieving-options)
- [Setting Options](#setting-options)

<a name="the-basics"></a>
## 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.

<a name="retrieving-options"></a>
##  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');

<a name="setting-options"></a>
## Setting Options

#### Set a configuration option:

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