In our design, we will just log the messages as if we are actually sending them. I am just keeping the code short, that's why! Strategy classes also don't return anything but depending on your needs, you can return something back.
installation of dependencies using composer
php composer install
use postman or your favorite tool to test
POST /messages/email
{
"message": "This is the message 1"
}
POST /messages/sms
{
"message": "This is the message 2"
}
POST /messages/voice
{
"message": "This is the message 3"
}
###Result
$ cat public/email.log
This is the message 1
$ cat public/sms.log
This is the message 2
$ cat public/voice.log
This is the message 3