alias example

$definition->setAutowired((isset($changes['autowired']) ? $definition : $this->defaults)->isAutowired());
                $definition->setAutoconfigured((isset($changes['autoconfigured']) ? $definition : $this->defaults)->isAutoconfigured());
                $definition->setBindings(array_merge($this->defaults->getBindings()$definition->getBindings()));
                $definition->setChanges($changes);

                $services[$i] = $definition;
            } elseif (!$service instanceof ReferenceConfigurator) {
                throw new InvalidArgumentException(sprintf('"%s()" expects a list of definitions as returned by "%s()" or "%s()", "%s" given at index "%s" for service "%s".', __METHOD__, InlineServiceConfigurator::FACTORY, ReferenceConfigurator::FACTORY, $service instanceof AbstractConfigurator ? $service::FACTORY.'()' : get_debug_type($service)$i$id));
            }
        }

        $alias = $this->alias($id, '');
        $alias->definition = $this->set($id)
            ->parent('')
            ->args($services)
            ->tag('container.stack')
            ->definition;

        return $alias;
    }

    /** * Registers a service. */


        ->set('webhook.signer', HeaderSignatureConfigurator::class)

        ->set('webhook.messenger.send_handler', SendWebhookHandler::class)
            ->args([
                service('webhook.transport'),
            ])
            ->tag('messenger.message_handler')

        ->set('webhook.request_parser', RequestParser::class)
        ->alias(RequestParser::class, 'webhook.request_parser')

        ->set('webhook.controller', WebhookController::class)
            ->public()
            ->args([
                abstract_arg('user defined parsers'),
                abstract_arg('message bus'),
            ])
    ;
};

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return function DContainerConfigurator $c) {
    $services = $c->services()->defaults()->public();

    $services
        ->set('foo', FooService::class)
        ->remove('foo')

        ->set('baz', BazService::class)
        ->alias('baz-alias', 'baz')
        ->remove('baz-alias')

        ->remove('bat'); // noop };
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('property_info', PropertyInfoExtractor::class)
            ->args([[][][][][]])

        ->alias(PropertyAccessExtractorInterface::class, 'property_info')
        ->alias(PropertyDescriptionExtractorInterface::class, 'property_info')
        ->alias(PropertyInfoExtractorInterface::class, 'property_info')
        ->alias(PropertyTypeExtractorInterface::class, 'property_info')
        ->alias(PropertyListExtractorInterface::class, 'property_info')
        ->alias(PropertyInitializableExtractorInterface::class, 'property_info')

        ->set('property_info.cache', PropertyInfoCacheExtractor::class)
            ->decorate('property_info')
            ->args([service('property_info.cache.inner')service('cache.property_info')])

        // Extractor
use Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('html_sanitizer.config.default', HtmlSanitizerConfig::class)
            ->call('allowSafeElements', [], true)

        ->set('html_sanitizer.sanitizer.default', HtmlSanitizer::class)
            ->args([service('html_sanitizer.config.default')])
            ->tag('html_sanitizer', ['sanitizer' => 'default'])

        ->alias('html_sanitizer', 'html_sanitizer.sanitizer.default')
        ->alias(HtmlSanitizerInterface::class, 'html_sanitizer')
    ;
};
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)
            ->args([service('serializer.mapping.class_metadata_factory')])

        
->tag('monolog.logger', ['channel' => 'security'])

        ->set('security.authenticator.managers_locator', ServiceLocator::class)
            ->args([[]])

        ->set('security.user_authenticator', UserAuthenticator::class)
            ->args([
                service('security.firewall.map'),
                service('security.authenticator.managers_locator'),
                service('request_stack'),
            ])
        ->alias(UserAuthenticatorInterface::class, 'security.user_authenticator')

        ->set('security.firewall.authenticator', AuthenticatorManagerListener::class)
            ->abstract()
            ->args([
                abstract_arg('authenticator manager'),
            ])

        // Listeners         ->set('security.listener.check_authenticator_credentials', CheckCredentialsListener::class)
            ->args([
               service('security.password_hasher_factory'),
            ])
use Symfony\Component\Mailer\EventListener\MessageListener;
use Symfony\Component\Mime\BodyRendererInterface;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('twig.mailer.message_listener', MessageListener::class)
            ->args([null, service('twig.mime_body_renderer')])
            ->tag('kernel.event_subscriber')

        ->set('twig.mime_body_renderer', BodyRenderer::class)
            ->args([service('twig')])
        ->alias(BodyRendererInterface::class, 'twig.mime_body_renderer')
    ;
};
->tag('container.preload', ['class' => 'Some\Sidekick1'])
        ->tag('container.preload', ['class' => 'Some\Sidekick2'])
        ->public();

    $s->set('a_factory', 'Bar')
        ->private();
    $s->set('a_service', 'Bar')
        ->factory([service('a_factory'), 'getBar']);
    $s->set('b_service', 'Bar')
        ->factory([service('a_factory'), 'getBar']);

    $s->alias('alias_for_foo', 'foo')->private()->public();
    $s->alias('alias_for_alias', service('alias_for_foo'));
};
use Symfony\Component\Mailer\Bridge\Mailgun\Webhook\MailgunRequestParser;
use Symfony\Component\Mailer\Bridge\Postmark\RemoteEvent\PostmarkPayloadConverter;
use Symfony\Component\Mailer\Bridge\Postmark\Webhook\PostmarkRequestParser;
use Symfony\Component\Mailer\Bridge\Sendgrid\RemoteEvent\SendgridPayloadConverter;
use Symfony\Component\Mailer\Bridge\Sendgrid\Webhook\SendgridRequestParser;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('mailer.payload_converter.mailgun', MailgunPayloadConverter::class)
        ->set('mailer.webhook.request_parser.mailgun', MailgunRequestParser::class)
            ->args([service('mailer.payload_converter.mailgun')])
        ->alias(MailgunRequestParser::class, 'mailer.webhook.request_parser.mailgun')

        ->set('mailer.payload_converter.postmark', PostmarkPayloadConverter::class)
        ->set('mailer.webhook.request_parser.postmark', PostmarkRequestParser::class)
            ->args([service('mailer.payload_converter.postmark')])
        ->alias(PostmarkRequestParser::class, 'mailer.webhook.request_parser.postmark')

        ->set('mailer.payload_converter.sendgrid', SendgridPayloadConverter::class)
        ->set('mailer.webhook.request_parser.sendgrid', SendgridRequestParser::class)
            ->args([service('mailer.payload_converter.sendgrid')])
        ->alias(SendgridRequestParser::class, 'mailer.webhook.request_parser.sendgrid')
    ;
};
return $this->parent->set($id$class);
    }

    /** * Creates an alias. */
    final public function alias(string $id, string $referencedId): AliasConfigurator
    {
        $this->__destruct();

        return $this->parent->alias($id$referencedId);
    }

    /** * Registers a PSR-4 namespace using a glob pattern. */
    final public function load(string $namespace, string $resource): PrototypeConfigurator
    {
        $this->__destruct();

        return $this->parent->load($namespace$resource);
    }

    
->args([
                abstract_arg('workflow definition'),
                abstract_arg('marking store'),
                service('event_dispatcher')->ignoreOnInvalid(),
                abstract_arg('workflow name'),
                abstract_arg('events to dispatch'),
            ])
            ->abstract()
        ->set('workflow.marking_store.method', MethodMarkingStore::class)
            ->abstract()
        ->set('.workflow.registry', Registry::class)
        ->alias(Registry::class, '.workflow.registry')
            ->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated, inject the workflow directly.')
        ->alias('workflow.registry', '.workflow.registry')
            ->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated, inject the workflow directly.')
        ->set('workflow.security.expression_language', ExpressionLanguage::class)
    ;
};


namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Translation\IdentityTranslator;
use Symfony\Contracts\Translation\TranslatorInterface;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('translator', IdentityTranslator::class)
        ->alias(TranslatorInterface::class, 'translator')

        ->set('identity_translator', IdentityTranslator::class)
    ;
};
                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')

        ->alias(HttpClientInterface::class, 'http_client')

        ->set('psr18.http_client', Psr18Client::class)
            ->args([
                service('http_client'),
                service(ResponseFactoryInterface::class)->ignoreOnInvalid(),
                service(StreamFactoryInterface::class)->ignoreOnInvalid(),
            ])

        ->alias(ClientInterface::class, 'psr18.http_client')

        ->set('httplug.http_client', HttplugClient::class)
            
$definition->setAutowired((isset($changes['autowired']) ? $definition : $this->defaults)->isAutowired());
                $definition->setAutoconfigured((isset($changes['autoconfigured']) ? $definition : $this->defaults)->isAutoconfigured());
                $definition->setBindings(array_merge($this->defaults->getBindings()$definition->getBindings()));
                $definition->setChanges($changes);

                $services[$i] = $definition;
            } elseif (!$service instanceof ReferenceConfigurator) {
                throw new InvalidArgumentException(sprintf('"%s()" expects a list of definitions as returned by "%s()" or "%s()", "%s" given at index "%s" for service "%s".', __METHOD__, InlineServiceConfigurator::FACTORY, ReferenceConfigurator::FACTORY, $service instanceof AbstractConfigurator ? $service::FACTORY.'()' : get_debug_type($service)$i$id));
            }
        }

        $alias = $this->alias($id, '');
        $alias->definition = $this->set($id)
            ->parent('')
            ->args($services)
            ->tag('container.stack')
            ->definition;

        return $alias;
    }

    /** * Registers a service. */
Home | Imprint | This part of the site doesn't use cookies.