简体   繁体   中英

Bundle for notifications in Symfony2

I want to include notifications, eg for forum threads. A user shall retrieve notifications if there are any new posts to a forum thread. Another example would be the notifications on Facebook, eg where you're notified of new comments on your posts or pictures.

Is there a notification bundle for Symfony2 that you can recommend for implementing such a function?

I came up with the Sonata NotificationBundle but I am unsure if this is what I really need. When I look at the usage examples it looks as if this would provide a email notification function

// retrieve the notification backend
$backend = $container->get('sonata.notification.backend');

// create and publish a message
$backend->createAndPublish('mailer', array(
    'from' => array(
        'email' => 'no-reply@sonata-project.org',
        'name'  => 'No Reply'
    ),
    'to'   => array(
        'myuser@example.org' => 'My User',
        'myuser1@example.org' => 'My User 1',
    ),
    'message' => array(
        'html' => '<b>hello</b>',
        'text' => 'hello'
    ),
    'subject' => 'Contact form',
));

or a logging function

$this->get('sonata.notification.backend')->createAndPublish('logger', array(
    'level' => 'debug',
    'message' => 'Hello world!'
));

Can you confirm/recommend the usage of that bundle? Or can you recommend any other?

Good news:
NotificationBundle from GeniusesOfSymfony https://github.com/GeniusesOfSymfony/NotificationBundle

Proper documentation will probably be published soon.
(on-going discussion here: https://github.com/GeniusesOfSymfony/WebSocketBundle/issues/4#issuecomment-81829513 )

I've already tested a similar bundle created by them (WebSocketBundle) which also provides real-time-interaction and it works really great. The documentation is also very good.

I recommend that you "star" the project on github. You can also create an issue to ask about the current status of the project.

I'm searching for the same library now, and also found https://github.com/namshi/notificator

Didn't use it yet, but it has 130 stars today, so probably will try it.

You can achieve this with sonata notification bundle.

You will need to create custom consumer class as described here

https://sonata-project.org/bundles/notification/3-x/doc/reference/usage.html#custom-consumer

You can try this Bundle: NotificationsBundle
It's a simple implementation for Pusher that provides a real time data proadcast.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM