Skip to content

Commit 6bf7e41

Browse files
committed
Upgrade to 5.1
1 parent 80a3e0e commit 6bf7e41

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
}
1111
],
1212
"require": {
13-
"minishlink/web-push": "^4.0.0"
13+
"minishlink/web-push": "^5.0.0"
1414
}
1515
}

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/send_push_notification.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@
2020

2121
$res = $webPush->sendNotification(
2222
$subscription,
23-
"Hello!",
24-
true
23+
"Hello!"
2524
);
2625

2726
// handle eventual errors here, and remove the subscription from your server if it is expired
28-
var_dump($res);
27+
foreach ($webPush->flush() as $report) {
28+
$endpoint = $report->getRequest()->getUri()->__toString();
29+
30+
if ($report->isSuccess()) {
31+
echo "[v] Message sent successfully for subscription {$endpoint}.";
32+
} else {
33+
echo "[x] Message failed to sent for subscription {$endpoint}: {$report->getReason()}";
34+
}
35+
}

0 commit comments

Comments
 (0)