After many refactorings I finally got what the best way is to implement the class and annotations scanner. In #221 I have added a auradi binary with a scan command. You can run this as follows:
# scan, but if cache exits, it returns the cache
vendor/bin/auradi scan
# force a complete new scan of all classes and annotations
vendor/bin/auradi scan --force
# use cache, and update only specific file
vendor/bin/auradi scan -u app/src/Controller/OrderController.php
The scan command will scan all packages, root and dependency packages, for an extra key in their composer.json. The paths added in the classmap-paths key will be scanned.
The result is a file vendor/aura.di.scan.json that contains information about all found classes and annotations. It can be used by the container by passing an extra config to the container builder.
[x] Improve documentation how to work with auradi binary
What's ahead for Aura/Di 5.1.0:
# execute a scan and watch for automatic file changes
vendor/bin/auradi scan --watch
The --watch parameter will use a new extension I am about to publish on PECL. The extension uses native filesystem notifications to rescan only the updated files.
Lessions from PR #221
After many refactorings I finally got what the best way is to implement the class and annotations scanner. In #221 I have added a
auradi
binary with ascan
command. You can run this as follows:The
scan
command will scan all packages, root and dependency packages, for an extra key in theircomposer.json
. The paths added in theclassmap-paths
key will be scanned.The result is a file
vendor/aura.di.scan.json
that contains information about all found classes and annotations. It can be used by the container by passing an extra config to the container builder.What's left for the publication of 5.0.0?
ComposerMapGenerator
ClassMap
auradi
binaryWhat's ahead for Aura/Di 5.1.0:
The
--watch
parameter will use a new extension I am about to publish on PECL. The extension uses native filesystem notifications to rescan only the updated files.