From the course: Symfony 6 Essential Training
Unlock the full course today
Join today to access over 25,100 courses taught by industry experts.
Notifications - Symfony Tutorial
From the course: Symfony 6 Essential Training
Notifications
- [Instructor] Most user facing apps will need to deal with communicating with the user somehow. Often, the implementation is an exercise for developers. Symfony provides some great tooling to make this a fast process. Using the same notifier components, we can send messages to SMS, email, chat, push channel, and more. I'm not going to actually demo this component because it would require a bunch of config and setup that would be unreasonably boring, but I can still show some code. First, let's add a new service. And I'll type in the constructor to the notifier interface, and I'm going to add a send method. First, I'll instantiate a notification. This requires the message, which is a subject, and the second argument can be an array of channels. I can also add content to the message and we can even include an emoji. The next piece of the puzzle is the recipient, and a recipient requires two pieces of information,…