--- layout: default title: Mutability description: When/how to update schemas and config values, and how to prevent others from doing so --- # Mutability Thanks to [lazy processing](/1.1/lazy-processing/), you can [define schemas](/1.1/schemas/) and [set user-provided values](/1.1/setting-values/) at any time and in any order. This can be very convenient in many cases, but you might have times where you'd like to provide a read-only version of the `Configuration` to ensure nobody else can modify it. ## Read-Only Reader To do this, simply call `$config->reader()`. This will return an object that only has the `get()` and `exists()` methods, preventing others from further modifying the configuration: ```php use League\Config\Configuration; $config = new Configuration([/* ... */]); $someOtherObject->setConfig($config->reader()); ``` Because both the reader and the main `Configuration` implement `ConfigurationInterface`, you can type-hint against that anywhere you need to retrieve values but not necessarily modify things.
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
basic-usage.md | File | 2.09 KB | 0644 |
|
changelog.md | File | 618 B | 0644 |
|
index.md | File | 1.41 KB | 0644 |
|
installation.md | File | 693 B | 0644 |
|
lazy-processing.md | File | 2.14 KB | 0644 |
|
mutability.md | File | 1.04 KB | 0644 |
|
philosophy.md | File | 2.53 KB | 0644 |
|
reading-values.md | File | 2.44 KB | 0644 |
|
schemas.md | File | 4.17 KB | 0644 |
|
setting-values.md | File | 2.19 KB | 0644 |
|
upgrading.md | File | 383 B | 0644 |
|