symfony / novu-notifier
为 Symfony Notifier 提供 Novu 集成。
v7.1.1
2024-05-31 14:57 UTC
Requires
- php: >=8.1
- symfony/http-client: ^5.4|^6.0|^7.0
- symfony/notifier: ^6.4
This package is auto-updated.
Last update: 2024-09-21 10:40:05 UTC
README
为 Symfony Notifier 提供 Novu 集成。
DSN 示例
NOVU_DSN=novu://API_KEY@default
通知示例
class NovuNotification extends Notification implements PushNotificationInterface { public function asPushMessage( NovuSubscriberRecipient|RecipientInterface $recipient, ?string $transport = null, ): ?PushMessage { return new PushMessage( $this->getSubject(), $this->getContent(), new NovuOptions( $recipient->getSubscriberId(), $recipient->getFirstName(), $recipient->getLastName(), $recipient->getEmail(), $recipient->getPhone(), $recipient->getAvatar(), $recipient->getLocale(), $recipient->getOverrides(), [], ), ); } }
$notification = new NovuNotification; $notification->subject('test'); $notification->channels(['push']); $notification->content( json_encode( [ 'param1' => 'Lorum Ipsum', ] ) ); $this->notifier->send( $notification, new NovuSubscriberRecipient( "123", 'Wouter', 'van der Loop', 'woutervdl@toppy.nl', null, null, null, [ 'email' => [ 'from' => 'no-reply@toppy.nl', 'senderName' => 'No-Reply', ], ], ), );