Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ autoDI:
- %appDir%/../vendor
```

You can ignore directories, like this:
```yaml
autoDI:
directories:
- %appDir%
- %appDir%/../vendor
ignoreDirectories:
- exludedDir
- anotherExludedDir
```

## Register services on configuration

Compiler extensions such as AutoDIExtension manipulates the DI container
Expand Down
5 changes: 5 additions & 0 deletions src/AutoDI/DI/AutoDIExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class AutoDIExtension extends CompilerExtension
'directories' => [
'%appDir%',
],
'ignoreDirectories' => [],
'defaults' => [],
'tempDir' => '%tempDir%',
];
Expand Down Expand Up @@ -55,6 +56,10 @@ private function registerServices(): void
$robotLoader->addDirectory($directory);
}

foreach ($config['ignoreDirectories'] as $ignoredDirectory) {
$robotLoader->ignoreDirs = $robotLoader->ignoreDirs . ',' . $ignoredDirectory;
}

$robotLoader->setTempDirectory($config['tempDir']);
$robotLoader->rebuild();

Expand Down