Skip to content

Commit 029fdf1

Browse files
committed
Update docs
1 parent 5876ebb commit 029fdf1

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

docs/1-essentials/05-discovery.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,18 @@ $registry = new Registry(locations: [
270270

271271
// Don't forget to register the registry in the container of your choice.
272272
$container->singleton(Registry::class, $registry);
273-
```
273+
```
274+
275+
### Using `tempest/container`
276+
277+
If you're using `tempest/container` with discovery, you'll have to make sure that the container itself is also registered as a singleton:
278+
279+
```php
280+
use Tempest\Container\Container;
281+
use Tempest\Container\GenericContainer;
282+
283+
$container = new GenericContainer();
284+
$container->singleton(Container::class, $container);
285+
```
286+
287+
This is because `tempest/container` comes with a handful of discovery classes itself, and they rely on the container being a singleton to configure it.

0 commit comments

Comments
 (0)