File tree 1 file changed +54
-0
lines changed
src/Symfony/Component/Notifier/Bridge/Novu
1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,60 @@ DSN example
10
10
NOVU_DSN=novu://API_KEY@default
11
11
```
12
12
13
+ Notification example
14
+ --------------------
15
+
16
+ ``` php
17
+ class NovuNotification extends Notification implements PushNotificationInterface
18
+ {
19
+ public function asPushMessage(
20
+ NovuSubscriberRecipient|RecipientInterface $recipient,
21
+ ?string $transport = null,
22
+ ): ?PushMessage {
23
+ return new PushMessage(
24
+ $this->getSubject(),
25
+ $this->getContent(),
26
+ new NovuOptions(
27
+ $recipient->getSubscriberId(),
28
+ $recipient->getFirstName(),
29
+ $recipient->getLastName(),
30
+ $recipient->getEmail(),
31
+ $recipient->getPhone(),
32
+ $recipient->getAvatar(),
33
+ $recipient->getLocale(),
34
+ [],
35
+ ),
36
+ );
37
+ }
38
+ }
39
+ ```
40
+
41
+ ``` php
42
+ $notification = new NovuNotification;
43
+ $notification->subject('test');
44
+ $notification->channels(['push']);
45
+ $notification->content(
46
+ json_encode(
47
+ [
48
+ 'param1' => 'Lorum Ipsum',
49
+ ]
50
+ )
51
+ );
52
+
53
+ $this->notifier->send(
54
+ $notification,
55
+ new NovuSubscriberRecipient(
56
+ "123",
57
+ 'Wouter',
58
+ 'van der Loop',
59
+ 'woutervdl@toppy.nl',
60
+ null,
61
+ null,
62
+ null,
63
+ ),
64
+ );
65
+ ```
66
+
13
67
Resources
14
68
---------
15
69
You can’t perform that action at this time.
0 commit comments