soraz
soraz

Reputation: 23

How to show all services in Symfony 3?

How to show all services in Symfony 3?

I tried:

bin/console debug:container --types

And ok, this show me services, but for logger is:

Psr\Log\LoggerInterface alias for "monolog.logger"

but if I would like to use in controller then I must use:

$logger = $this->get('logger');

(I know - in Symfony 3.3 I can pass LoggerInterface in controller)

For email:

Swift_Mailer alias for "swiftmailer.mailer.default"
Swift_Spool alias for "swiftmailer.mailer.default.spool.memory"
Swift_Transport alias for "swiftmailer.mailer.default.transport.spool"

But in controller I must use:

$mailer = $this->get('mailer');

So how can I find what I have to type in the controller to use the service?

Upvotes: 2

Views: 4390

Answers (1)

Alessandro Minoccheri
Alessandro Minoccheri

Reputation: 35973

If you launch the command without --types like this:

bin/console debug:container 

you can see all services and I can see:

mailer      alias for "swiftmailer.mailer.default"

Upvotes: 11

Related Questions