Register every Controller, Repository or Command in your app.
No need to do that manually in config.yml
files. Very useful in large projects to keep configs clean.
composer require symplify/auto-service-registration
Add bundle to AppKernel.php
:
class AppKernel extends Kernel
{
public function registerBundles(): array
{
$bundles = [
new Symplify\AutoServiceRegistration\Adapter\Symfony\SymplifyAutoServiceRegistrationBundle(),
// ...
];
}
}
# app/config/config.yml with default value
symplify_auto_service_registration:
directories_to_scan: # where to scan classes
- %kernel.root_dir%
- %kernel.root_dir%/../src
class_suffixes_to_seek: # what class name suffixes to look for
- Controller
That's all :)
Send issue or pull-request to main repository.