Menu

Push notifications the Laravel way: a custom APNs notification channel
📰

Push notifications the Laravel way: a custom APNs notification channel

DEV Community: laravel·Guppylab·1 day ago
#rSh8UC8Q
#devtolaravel#devto#dev#token#user
Reading 0:00
15s threshold

In the first part we sent iOS push notifications straight to Apple: a .p8 key, a cached JWT, one HTTP/2 request inside a queued job. It works, but every place that sends a push has to know about tokens, devices and that job.

Laravel already has a better shape for this. Mail, SMS and Slack all go through notifications, and push can too. By the end of this post, this is all it takes:

$user -> notify ( new OrderShipped ( $order ));

Enter fullscreen mode

Exit fullscreen mode

The notification lands on every iPhone the user is signed in on, a dead token cleans itself up, and a tap opens /orders/1234 . No Firebase, no package.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.