args example



namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Notifier\DataCollector\NotificationDataCollector;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('notifier.data_collector', NotificationDataCollector::class)
            ->args([service('notifier.notification_logger_listener')])
            ->tag('data_collector', ['template' => '@WebProfiler/Collector/notifier.html.twig', 'id' => 'notifier'])
    ;
};
use Symfony\Component\Notifier\Messenger\MessageHandler;
use Symfony\Component\Notifier\Notifier;
use Symfony\Component\Notifier\NotifierInterface;
use Symfony\Component\Notifier\Texter;
use Symfony\Component\Notifier\TexterInterface;
use Symfony\Component\Notifier\Transport;
use Symfony\Component\Notifier\Transport\Transports;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('notifier', Notifier::class)
            ->args([tagged_locator('notifier.channel', 'channel')service('notifier.channel_policy')->ignoreOnInvalid()])

        ->alias(NotifierInterface::class, 'notifier')

        ->set('notifier.channel_policy', ChannelPolicy::class)
            ->args([[]])

        ->set('notifier.flash_message_importance_mapper', DefaultFlashMessageImportanceMapper::class)
            ->args([[]])

        ->set('notifier.channel.browser', BrowserChannel::class)
            ->args([service('request_stack')service('notifier.flash_message_importance_mapper')])
            
use Symfony\Component\Security\Http\RememberMe\PersistentRememberMeHandler;
use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface;
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
use Symfony\Component\Security\Http\RememberMe\SignatureRememberMeHandler;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('security.rememberme.response_listener', ResponseListener::class)
            ->tag('kernel.event_subscriber')

        ->set('security.authenticator.remember_me_signature_hasher', SignatureHasher::class)
            ->args([
                service('property_accessor'),
                abstract_arg('signature properties'),
                '%kernel.secret%',
                null,
                null,
            ])

        ->set('security.authenticator.signature_remember_me_handler', SignatureRememberMeHandler::class)
            ->abstract()
            ->args([
                abstract_arg('signature hasher'),
                
use Symfony\Bundle\FrameworkBundle\Test\TestContainer;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\History;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\HttpKernel\EventListener\SessionListener;

return static function DContainerConfigurator $container) {
    $container->parameters()->set('test.client.parameters', []);

    $container->services()
        ->set('test.client', KernelBrowser::class)
            ->args([
                service('kernel'),
                param('test.client.parameters'),
                service('test.client.history'),
                service('test.client.cookiejar'),
            ])
            ->share(false)
            ->public()

        ->set('test.client.history', History::class)->share(false)
        ->set('test.client.cookiejar', CookieJar::class)->share(false)

        
use Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\SerializerInterface;

return static function DContainerConfigurator $container) {
    $container->parameters()
        ->set('serializer.mapping.cache.file', '%kernel.cache_dir%/serialization.php')
    ;

    $container->services()
        ->set('serializer', Serializer::class)
            ->args([[][]])

        ->alias(SerializerInterface::class, 'serializer')
        ->alias(NormalizerInterface::class, 'serializer')
        ->alias(DenormalizerInterface::class, 'serializer')
        ->alias(EncoderInterface::class, 'serializer')
        ->alias(DecoderInterface::class, 'serializer')

        ->alias('serializer.property_accessor', 'property_accessor')

        // Discriminator Map         ->set('serializer.mapping.class_discriminator_resolver', ClassDiscriminatorFromClassMetadata::class)
            
use Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler;
use Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator;
use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;

return static function DContainerConfigurator $container) {
    $container->services()

        ->set('web_profiler.controller.profiler', ProfilerController::class)
            ->public()
            ->args([
                service('router')->nullOnInvalid(),
                service('profiler')->nullOnInvalid(),
                service('twig'),
                param('data_collector.templates'),
                service('web_profiler.csp.handler'),
                param('kernel.project_dir'),
            ])

        ->set('web_profiler.controller.router', RouterController::class)
            ->public()
            ->args([
                


namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\CombinedStore;
use Symfony\Component\Lock\Strategy\ConsensusStrategy;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('lock.store.combined.abstract', CombinedStore::class)->abstract()
            ->args([abstract_arg('List of stores')service('lock.strategy.majority')])

        ->set('lock.strategy.majority', ConsensusStrategy::class)

        ->set('lock.factory.abstract', LockFactory::class)->abstract()
            ->args([abstract_arg('Store')])
            ->call('setLogger', [service('logger')->ignoreOnInvalid()])
            ->tag('monolog.logger', ['channel' => 'lock'])
    ;
};
use Symfony\Component\Webhook\Client\RequestParser;
use Symfony\Component\Webhook\Controller\WebhookController;
use Symfony\Component\Webhook\Messenger\SendWebhookHandler;
use Symfony\Component\Webhook\Server\HeadersConfigurator;
use Symfony\Component\Webhook\Server\HeaderSignatureConfigurator;
use Symfony\Component\Webhook\Server\JsonBodyConfigurator;
use Symfony\Component\Webhook\Server\Transport;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('webhook.transport', Transport::class)
            ->args([
                service('http_client'),
                service('webhook.headers_configurator'),
                service('webhook.body_configurator.json'),
                service('webhook.signer'),
            ])

        ->set('webhook.headers_configurator', HeadersConfigurator::class)

        ->set('webhook.body_configurator.json', JsonBodyConfigurator::class)
            ->args([
                service('serializer'),
            ])


namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Bundle\FrameworkBundle\Secrets\DotenvVault;
use Symfony\Bundle\FrameworkBundle\Secrets\SodiumVault;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('secrets.vault', SodiumVault::class)
            ->args([
                abstract_arg('Secret dir, set in FrameworkExtension'),
                service('secrets.decryption_key')->ignoreOnInvalid(),
            ])
            ->tag('container.env_var_loader')

        ->set('secrets.decryption_key')
            ->parent('container.env')
            ->args([abstract_arg('Decryption env var, set in FrameworkExtension')])

        ->set('secrets.local_vault', DotenvVault::class)
            ->args([abstract_arg('.env file path, set in FrameworkExtension')])
    ;
namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Form\Extension\DataCollector\FormDataCollector;
use Symfony\Component\Form\Extension\DataCollector\FormDataExtractor;
use Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeFactoryDataCollectorProxy;
use Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension;
use Symfony\Component\Form\ResolvedFormTypeFactory;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('form.resolved_type_factory', ResolvedTypeFactoryDataCollectorProxy::class)
            ->args([
                inline_service(ResolvedFormTypeFactory::class),
                service('data_collector.form'),
            ])

        ->set('form.type_extension.form.data_collector', DataCollectorTypeExtension::class)
            ->args([service('data_collector.form')])
            ->tag('form.type_extension')

        ->set('data_collector.form.extractor', FormDataExtractor::class)

        ->set('data_collector.form', FormDataCollector::class)
            
use Symfony\Component\HttpClient\HttplugClient;
use Symfony\Component\HttpClient\Messenger\PingWebhookMessageHandler;
use Symfony\Component\HttpClient\Psr18Client;
use Symfony\Component\HttpClient\Retry\GenericRetryStrategy;
use Symfony\Component\HttpClient\UriTemplateHttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('http_client.transport', HttpClientInterface::class)
            ->factory([HttpClient::class, 'create'])
            ->args([
                [], // default options                 abstract_arg('max host connections'),
            ])
            ->call('setLogger', [service('logger')->ignoreOnInvalid()])
            ->tag('monolog.logger', ['channel' => 'http_client'])
            ->tag('kernel.reset', ['method' => 'reset', 'on_invalid' => 'ignore'])

        ->set('http_client', HttpClientInterface::class)
            ->factory('current')
            ->args([[service('http_client.transport')]])
            ->tag('http_client.client')

        
->set('unit_enum', FooUnitEnum::BAR)
        ->set('enum_array', [FooUnitEnum::BAR, FooUnitEnum::FOO]);

    $services = $container->services();

    $services->defaults()->public();

    $services->set('service_container', ContainerInterface::class)
        ->synthetic();

    $services->set(FooClassWithEnumAttribute::class)
        ->args([FooUnitEnum::BAR]);
};
use Symfony\Component\Form\Extension\PasswordHasher\EventListener\PasswordHasherListener;
use Symfony\Component\Form\Extension\PasswordHasher\Type\FormTypePasswordHasherExtension;
use Symfony\Component\Form\Extension\PasswordHasher\Type\PasswordTypePasswordHasherExtension;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('security.password_hasher_factory', PasswordHasherFactory::class)
            ->args([[]])
        ->alias(PasswordHasherFactoryInterface::class, 'security.password_hasher_factory')

        ->set('security.user_password_hasher', UserPasswordHasher::class)
            ->args([service('security.password_hasher_factory')])
        ->alias('security.password_hasher', 'security.user_password_hasher')
        ->alias(UserPasswordHasherInterface::class, 'security.password_hasher')

        ->set('form.listener.password_hasher', PasswordHasherListener::class)
            ->args([
                service('security.password_hasher'),
                service('property_accessor')->nullOnInvalid(),
            ])
use Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;

return static function DContainerConfigurator $container) {
    $container->parameters()
        ->set('asset.request_context.base_path', null)
        ->set('asset.request_context.secure', null)
    ;

    $container->services()
        ->set('assets.packages', Packages::class)
            ->args([
                service('assets._default_package'),
                tagged_iterator('assets.package', 'package'),
            ])

        ->alias(Packages::class, 'assets.packages')

        ->set('assets.empty_package', Package::class)
            ->args([
                service('assets.empty_version_strategy'),
            ])

        


namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\RemoteEvent\Messenger\ConsumeRemoteEventHandler;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('remote_event.messenger.handler', ConsumeRemoteEventHandler::class)
            ->args([
                tagged_locator('remote_event.consumer', 'consumer'),
            ])
            ->tag('messenger.message_handler')
    ;
};
Home | Imprint | This part of the site doesn't use cookies.