[FEATURE] Introduce PSR-14-based EventDispatcher as alternative for hooks
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Configuration / Services.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Core;
4
5 use Psr\Http\Server\MiddlewareInterface;
6 use Psr\Http\Server\RequestHandlerInterface;
7 use Psr\Log\LoggerAwareInterface;
8 use Symfony\Component\DependencyInjection\ContainerBuilder;
9 use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
10
11 return function (ContainerConfigurator $container, ContainerBuilder $containerBuilder) {
12 $containerBuilder->registerForAutoconfiguration(SingletonInterface::class)->addTag('typo3.singleton');
13 $containerBuilder->registerForAutoconfiguration(LoggerAwareInterface::class)->addTag('psr.logger_aware');
14
15 // Services, to be read from container-aware dispatchers (on demand), therefore marked 'public'
16 $containerBuilder->registerForAutoconfiguration(MiddlewareInterface::class)->addTag('typo3.middleware');
17 $containerBuilder->registerForAutoconfiguration(RequestHandlerInterface::class)->addTag('typo3.request_handler');
18
19 $containerBuilder->addCompilerPass(new DependencyInjection\SingletonPass('typo3.singleton'));
20 $containerBuilder->addCompilerPass(new DependencyInjection\LoggerAwarePass('psr.logger_aware'));
21 $containerBuilder->addCompilerPass(new DependencyInjection\ListenerProviderPass('event.listener'));
22 $containerBuilder->addCompilerPass(new DependencyInjection\PublicServicePass('typo3.middleware'));
23 $containerBuilder->addCompilerPass(new DependencyInjection\PublicServicePass('typo3.request_handler'));
24 $containerBuilder->addCompilerPass(new DependencyInjection\AutowireInjectMethodsPass());
25 };