This question already has an answer here:
- Symfony2 global functions 2 answers
I would like to know what is the best way to create a global function in Symfony 3.
I'll provide an example: On my website, you can subscribe to the newsletter. When you do, it sends you an email to thank you. The user can do this on many pages.
So I would like to create it once, and use the sending mail function
in all the controllers that need it.
Do I have to create it as a class in the app, or do I have to create a bundle specially for it?
I found this answer, but not sure it's the best: Symfony2 global functions
</div>