Skip to content

Commit ba94673

Browse files
committed
Docs, of course
1 parent 223fb13 commit ba94673

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

docs/1-essentials/05-discovery.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,35 @@ $registry = new Registry(locations: [
257257
new DiscoveryLocation('App\\', 'src/'),
258258
// …
259259
]);
260+
```
261+
262+
### Config and caching
263+
264+
You can pass optional config and cache parameters into the `BootDiscovery` action, with these you can exclude files and classes from discovery, as well as config caching behavior:
265+
266+
```php
267+
use Tempest\Discovery\BootDiscovery;
268+
use Tempest\Discovery\DiscoveryCache;
269+
use Tempest\Discovery\DiscoveryCacheStrategy;
270+
use Tempest\Discovery\DiscoveryConfig;
271+
use Tempest\Discovery\Registry;
272+
273+
new BootDiscovery(
274+
container: $container,
275+
registry: Registry::autoload(__DIR__),
276+
config: new DiscoveryConfig()
277+
->skipClasses(
278+
\App\Foo::class,
279+
\Tempest\Container\AutowireDiscovery::class
280+
)
281+
->skipPaths(
282+
__DIR__ . '/../vendor/tempest/support'
283+
),
284+
cache: new DiscoveryCache(
285+
strategy: DiscoveryCacheStrategy::PARTIAL,
286+
pool: new PhpFilesAdapter(
287+
directory: __DIR__ . '/.cache/discovery'
288+
)
289+
),
290+
)();
260291
```

0 commit comments

Comments
 (0)