yokai / messenger-bundle
Simplify message sending processes in a Symfony project
Installs: 21 122
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 6
Forks: 3
Open Issues: 6
pkg:composer/yokai/messenger-bundle
Requires
- php: >=5.6
- symfony/framework-bundle: ~2.8|~3.0|~4.0
- symfony/translation: ~2.8|~3.0|~4.0
- twig/twig: ~1.34|~2.0
- yokai/dependency-injection: ~1.0
Requires (Dev)
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ^2.4.8
- phpunit/phpunit: ~5.0
- sly/notification-pusher: ~2.2
- symfony/swiftmailer-bundle: ~2.3
- twilio/sdk: ~5.17
Suggests
- doctrine/doctrine-bundle: Required to use the Doctrine channel that allow storing message in database
- doctrine/orm: Required to use the Doctrine channel that allow storing message in database
- sly/notification-pusher: Required to use the Mobile channel that allow sending message via mobile notification
- symfony/swiftmailer-bundle: Required to use the Doctrine channel that allow sending message via email
- twilio/sdk: Required to use the Twilio channel that allow sending message via SMS
- dev-master / 1.0.x-dev
- v1.5
- v1.4
- v1.3
- v1.2
- v1.1
- v1.0
- v0.1.0
- dev-allow-not-building-subject-nor-body
- dev-replace-templating-with-twig
- dev-less-specific-recipients
- dev-issue-29-dont-force-integer-recipient-id-doctrine
- dev-issue-28-autowire-message-sender
- dev-symfony-4-symfony-flex-support
- dev-swiftmailer-6-compatibility
- dev-bugfix-symfony-flex-compatibility
- dev-sensio-insight-fixes
- dev-register-entities-only-if-needed
- dev-travis-matrix
- dev-clean/code-standards
- dev-additional_mobile_data
- dev-fix-travis-ci
This package is auto-updated.
Last update: 2020-04-25 15:34:52 UTC
README
⚠️ This package is abandoned and no longer maintained. The author suggests using the symfony/notifier package instead.
Simplify message sending processes in a Symfony2 project.
Imagine that your application sends emails, triggers UI notifications, sends SMS. You are using several libraries to do it. And if you did not factorize your code, you will have bunch of copy paste in every place you are sending something.
Worst, if you was expecting to send an email some day, you may send also an SMS tomorrow. If that happen, you will need to rewrite your code...
This bundle is trying to help with all these problems, providing a simple way to configure a distribute these messages.
Principles
Message
A message represent the fact that your application is sending something.
Creating a message is as easy as creating a service of class Yokai\MessengerBundle\Message
with at least 1 yokai_messenger.message tag,
for each tag you specify the channel on which the message should be distributed.
You can also register it using this bundle configuration.
Recipient
A recipient represent the information about the target of your message.
Every channel is free to support only certain types of recipient (mostly by checking interfaces).
Channel
A channel represent a way to distribute messages.
This bundle come with some built-in channels:
- Yokai\MessengerBundle\Channel\SwiftmailerChannel: sending an email with Swift Mailer. Read the channel documentation
- Yokai\MessengerBundle\Channel\DoctrineChannel: recording a database entry with Doctrine ORM. Read the channel documentation
- Yokai\MessengerBundle\Channel\MobileChannel: pushing a mobile notification with NotificationPusher. Read the channel documentation
Creating a channel is as easy as creating a service that implements Yokai\MessengerBundle\Channel\ChannelInterface
with the yokai_messenger.channel tag.
A channel will be asked to handle a delivery whenever a message is about to be sent.
Delivery
A delivery (Yokai\MessengerBundle\Delivery) represent the message about to be sent to a recipient for a channel.
It is mainly matter of storing all the data in the same place.
Creating a delivery is an internal process, that must be done by the sender.
Sender
The sender is your entry point for sending messages.
It centralize the configuration of which messages to send over which channels.
Installation
Add the bundle as dependency with Composer
$ php composer.phar require yokai/messenger-bundle
Enable the bundle in the kernel
<?php // app/AppKernel.php public function registerBundles() { $bundles = [ // ... new Yokai\MessengerBundle\YokaiMessengerBundle(), ]; }
Configuration
Please read the dedicated documentation.
Usage
Please read the dedicated documentation.
MIT License
License can be found here.
Authors
The bundle was originally created by Yann Eugoné.
See the list of contributors.