Download the PHP package symfony-bundles/event-queue-bundle without Composer
On this page you can find all versions of the php package symfony-bundles/event-queue-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download symfony-bundles/event-queue-bundle
More information about symfony-bundles/event-queue-bundle
Files in symfony-bundles/event-queue-bundle
Package event-queue-bundle
Short Description Symfony EventQueue Bundle
License MIT
Homepage https://github.com/symfony-bundles/event-queue-bundle
Informations about the package event-queue-bundle
SymfonyBundlesEventQueueBundle
Installation
-
Require the bundle with composer:
-
Enable the bundle in the kernel:
- Configure the EventQueue bundle in your config.yml.
Defaults configuration:
- Configure the redis client in your config.yml. Read more about RedisBundle configuration.
How to use
Add an event to the queue:
Your event class must implement SymfonyBundles\EventQueueBundle\EventInterface
(or extending SymfonyBundles\EventQueueBundle\Event
class)
and having constant NAME
with the event name. For example:
Creating an Event Listener. The most common way to listen to an event is to register an event listener:
Now that the class is created, you just need to register it as a service and notify Symfony that it is a "listener":
Execution (dispatching) of all events from the queue:
You can separate the events by section, specifying in event manager the needed section.
In this example, will be executed only an events from the section email.notifications
:
Console commands:
event:queue:dispatch
event:queue:daemon:start
event:queue:daemon:stop
In what situations is useful to apply the queue of events:
- When sending email messages
- Parsing websites
- and in other cases, when the execution time of process is very long, and the response from the server must be returned immediately.
All versions of event-queue-bundle with dependencies
symfony/console Version ^3.0
symfony-bundles/queue-bundle Version ^1.0
symfony-bundles/bundle-dependency Version ^1.0