Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.69 KB

File metadata and controls

60 lines (39 loc) · 1.69 KB

Auto Register Services By Class Name Suffix - Deprecated, in core of Symfony 3.3+


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.

Build Status Code Coverage Downloads

Install

composer require symplify/auto-service-registration

Registration in Symfony

Add bundle to AppKernel.php:

class AppKernel extends Kernel
{
    public function registerBundles(): array
    {
        $bundles = [
            new Symplify\AutoServiceRegistration\Adapter\Symfony\SymplifyAutoServiceRegistrationBundle(),
            // ...
        ];
    }
}

Usage in Symfony

# 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 :)

Contributing

Send issue or pull-request to main repository.