Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Webpush Laravel Package

laravel-notification-channels/webpush

Laravel notification channel for sending Web Push notifications. Supports VAPID keys, major browsers, rich payload options (title, actions, data, TTL), and easy subscription management on models with automatic cleanup of expired endpoints.

View on GitHub
Deep Wiki
Context7

Webpush notifications channel for Laravel.

Frequently asked questions about Webpush
How do I integrate Web Push notifications into an existing Laravel notification system?
Install the package via Composer, add the `HasPushSubscriptions` trait to your User model, publish the config and migrations, and run `php artisan webpush:vapid` to generate VAPID keys. Then, use the `WebPushChannel` in your notification class like any other Laravel channel.
Which Laravel versions does this package support?
The package officially supports Laravel 12 and above. If you're using Laravel 11 or below, ensure you’re on version 10.x of this package, as newer releases drop support for older Laravel versions.
How do I generate and manage VAPID keys securely?
Run `php artisan webpush:vapid` to generate keys and store them in your `.env` file. For production, use a secure vault like AWS Secrets Manager or HashiCorp Vault instead of `.env` to avoid hardcoding sensitive keys.
Does this package support Safari/iOS push notifications?
Yes, but Safari requires additional configuration. You must set the `VAPID_SUBJECT` in your config to match your domain. Test thoroughly, as Safari’s push support is less mature than other browsers.
How do I handle expired push subscriptions automatically?
The package automatically detects and deletes expired subscriptions when sending notifications. Ensure your `push_subscriptions` table has the `expired` flag enabled and that your TTL (time-to-live) settings are correctly configured.
Can I customize the push notification payload (e.g., title, actions, data)?
Absolutely. Use the `title`, `body`, `icon`, `actions`, `data`, and other options in the `WebPushMessage` constructor. You can also extend the `WebPushMessage` class to add custom fields like vibration or badge updates.
What happens if a push notification fails to send?
The package dispatches `NotificationFailed` events for failed notifications, which you can listen to for retries or analytics. Failed notifications due to expired subscriptions are automatically cleaned up.
How do I trigger push subscriptions on the frontend?
The package handles backend logic, but you’ll need to implement the Push API subscription flow on the frontend using JavaScript. This typically involves registering a service worker and calling `navigator.serviceWorker.register()` with your VAPID public key.
Is there a way to fallback to email if Web Push fails?
Yes. Extend the `via()` method in your notification class to include both `WebPushChannel` and `MailChannel`, like `via(['webpush', 'mail'])`. This ensures users receive an email if the push fails.
What are the performance considerations for high-volume push notifications?
High-volume notifications may strain your server. Benchmark your setup and consider rate-limiting or batching notifications. For scalability, offload push delivery to a queue worker or use a third-party service like Firebase Cloud Messaging.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky