webchemistry / service-attribute
Installs: 2 721
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >= 8.1
- nette/finder: ^2.5 || ^v3.0.0
- nette/neon: ^3.2
- webchemistry/class-finder: ^1.0
Requires (Dev)
- nette/tester: ^2.3
README
<?php declare(strict_types = 1); use Nette\Utils\Finder; use WebChemistry\ServiceAttribute\DecoratorFinder; use WebChemistry\ServiceAttribute\Generator\DecoratorNeonGenerator; use WebChemistry\ServiceAttribute\Generator\NeonFile; use WebChemistry\ServiceAttribute\Generator\ServiceNeonGenerator; use WebChemistry\ServiceAttribute\ServiceFinder; use WebChemistry\ServiceAttribute\Validator\DecoratorValidator; require __DIR__ . '/vendor/autoload.php'; $directory = Finder::find('*.php') ->from(__DIR__ . '/app'); // decorators echo "\e[36mDecorators\e[39m\n"; $decorators = DecoratorFinder::findDecorators($directory); DecoratorValidator::validate($decorators); $neon = new NeonFile($path = __DIR__ . '/app/generated/decorators.neon', (new DecoratorNeonGenerator($decorators))->generate()); $neon->diff(); $neon->save(); echo sprintf("File generated from %d decorators: file://%s\n", count($decorators), $path); // services echo "\e[36mServices\e[39m\n"; $services = ServiceFinder::findServices($directory); $neon = new NeonFile($path = __DIR__ . '/app/generated/services.neon', (new ServiceNeonGenerator($services))->generate()); $neon->diff(); $neon->save(); echo sprintf("File generated from %d services: file://%s\n", count($services), $path);
run:
php services.php