You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Call `build()` to persist the discovery results as PHP return files. Subsequent bootstraps can load these files instead of re-scanning the directory on every request.
564
+
Call `build()` to persist the discovery results as PHP return files, which you can commit to your repository or load at runtime for faster access without needing to scan directories:
565
565
566
566
```php
567
-
$discovery = new ProviderDiscovery('/path/to/src');
To validate that your container can satisfy all discovered dependencies before running any workflow, call `assert()`:
583
+
### Validating Dependencies
584
+
585
+
To validate that your container can satisfy all discovered dependencies before running any workflow, call `assert()` on `Dependencies` with your container instance. It will throw if any required class is missing:
598
586
599
587
```php
588
+
$dependencies = new Dependencies(
589
+
...$discovery->dependencies(),
590
+
...$discovery->providers()
591
+
);
600
592
$dependencies->assert($container);
601
593
```
602
594
603
-
### Working with any PSR-11 container
604
-
605
-
Use the discovered dependency list to assert that your PSR-11 container can satisfy every dependency before running any workflow:
595
+
You can also manually check the list of dependencies against your PSR-11 container:
606
596
607
597
```php
608
598
use Chevere\Workflow\ProviderDiscovery;
@@ -636,6 +626,7 @@ $container = new Container(
636
626
);
637
627
638
628
// Run workflow with container
629
+
// The system will auto-inject and assert dependencies.
0 commit comments