Weave 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

Web Push Laravel Package

minishlink/web-push

WebPush is a PHP library implementing the Web Push protocol (RFC 8030) for sending push notifications to browser endpoints. It handles Subscription objects, payload encryption, VAPID authentication, and delivery to service workers. Requires PHP 8.2+ with curl, openssl, and mbstring.

View on GitHub
Deep Wiki
Context7

Web Push library for PHP

Frequently asked questions about Web Push
How do I use minishlink/web-push in a Laravel application?
Install it with Composer and call it from a service class or a custom Laravel notification channel. The library has no service provider, facade, or config file, so your application owns subscription storage, queueing, retries, and telemetry. Treat it as a transport primitive behind a thin wrapper rather than a full push product.
Does minishlink/web-push support Laravel 11 and PHP 8.2?
Yes. The latest release requires PHP 8.2+ with curl, openssl with elliptic curve support, and mbstring, and it is framework-agnostic, so it works cleanly inside Laravel 11. Because there is no Laravel integration layer, compatibility depends on your PHP version and Composer constraints rather than a Laravel service provider.
How do I generate and store VAPID keys for web push in Laravel?
Generate the VAPID key pair once with the library or OpenSSL, then store it in a secrets manager or encrypted vault with backups. Do not keep production VAPID keys only in a single-node .env file, because losing them forces every browser subscription to be recreated. Treat the key pair as a long-lived secret with an explicit custody and disaster-recovery policy.
Why does changing my VAPID key break existing push subscriptions?
Browser push subscriptions are bound to the VAPID application server key used when the user subscribed, so a new key pair invalidates all stored subscriptions. Re-subscribing every user is usually impractical, which is why VAPID key permanence matters more than routine credential rotation. Plan key custody and backup before sending production traffic.
What is the maximum payload size for web push with minishlink/web-push?
The practical payload limit is about 3052 bytes, and the library encrypts the payload according to the Web Push encryption specifications. Keep payloads small and avoid PII or secrets, because messages still transit third-party push infrastructure even though they are encrypted. Send identifiers and fetch sensitive data behind authenticated endpoints instead.
Should I call flush() inside a Laravel request or queue it?
Queue it. flush() performs synchronous Guzzle HTTP requests and blocks until delivery completes, so calling it in a web request is a latency and timeout risk. Use queueNotification() plus flush() inside a queued job, or sendOneNotification() from a worker, and keep request cycles free of push delivery work.
How do I handle expired or gone push subscriptions in Laravel?
Inspect each MessageSentReport returned by flush() and check isSubscriptionExpired() to identify endpoints that should be pruned. Persist subscription records in your own database and delete or disable expired ones during the send job or a scheduled cleanup task. Because flush() returns a single-pass generator, iterate it once and record outcomes as you go.
Can I inject a custom Guzzle client into minishlink/web-push for proxies and timeouts?
Yes. The library supports injecting a Guzzle client, so you can centralize proxy settings, TLS policy, timeouts, and retry behavior in one place. This fits Laravel well because Guzzle is already present transitively through the HTTP client, and it lets your infrastructure team control outbound push traffic consistently.
How do I test web push notifications in Laravel without hitting real browser endpoints?
Inject a mock or fake Guzzle client and assert the requests your application builds, including endpoint URLs, VAPID headers, and encrypted payload shape. Use Subscription::create() with fixture data that matches the browser PushSubscription.toJSON() output, and test expiry handling by returning 404 or 410 style responses from the fake client. Keep integration tests separate from unit tests that exercise your notification channel logic.
What are alternatives to minishlink/web-push for Laravel push notifications?
Alternatives include hosted services such as OneSignal, Firebase Cloud Messaging web push, and Pusher Beams, or building directly on Laravel's notification channels for other transports. minishlink/web-push is different because it is a low-level RFC 8030 transport library, not a managed push platform. Choose it when you want control over storage, retries, and telemetry, and choose a vendor when you want an out-of-the-box product.
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.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels