Skip to content

Commit a912403

Browse files
authored
Update README.md
1 parent d6d781e commit a912403

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
### Features
1717

1818
- Inherits services from a parent PSR-11 Service Container
19-
- Can be forked into a new isolated container, inheriting all services definitions from the original container
19+
- [Can be forked into a new isolated container](#isolated-layers-forked-from-the-service-container), inheriting all services definitions from the original container
2020
- [PSR Container][psr-11] compatibility
2121
- Autowiring — automatic dependencies resolution
2222
- Full PHP 8.0+ features support for auto-wiring (e.g. union types)
@@ -205,8 +205,12 @@ But defining new scope variables won't modify the parent scope. That's it.
205205
$project = new CascadeContainer();
206206
$project->set('configuration', $config);
207207

208-
$module = $project->cascade();
209-
$module->set('configuration', $config->extend($local));
208+
$module = $project->cascade(); // MAGIC! ✨
209+
210+
// Override existing services. It does not affect 'configuration' service in the parent container.
211+
$module->set('configuration', $moduleConfig);
212+
213+
// Define new services. They'll only exist on the current layer.
210214
$module->factory('request', function () {
211215
// ...
212216
});

0 commit comments

Comments
 (0)