我想包含通知,例如用于论坛主题。如果论坛主题中有任何新帖子,用户应检索通知。另一个例子是 Facebook 上的通知,例如当您的帖子或图片有新评论时,您会收到通知。
您是否可以推荐 Symfony2 的通知包来实现此类功能?
我想出了Sonata NotificationBundle但我不确定这是否是我真正需要的。当我查看使用示例
时,它看起来好像可以提供电子邮件通知功能
// 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',
));
或日志记录功能
$this->get('sonata.notification.backend')->createAndPublish('logger', array(
'level' => 'debug',
'message' => 'Hello world!'
));
您能确认/推荐该 bundle 的使用吗?或者可以推荐其他的吗?
最佳答案
好消息:
来自 GeniusesOfSymfony 的通知包
https://github.com/GeniusesOfSymfony/NotificationBundle
适当的文档可能很快就会发布。
(此处正在进行的讨论:https://github.com/GeniusesOfSymfony/WebSocketBundle/issues/4#issuecomment-81829513)
我已经测试了他们创建的类似 bundle (WebSocketBundle),它也提供实时交互,而且效果非常好。文档也非常好。
我建议您在 github 上为该项目“加注星标”。您还可以创建一个问题来询问项目的当前状态。
关于symfony - Symfony2 中的通知包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24041277/