Download the PHP package ngoahamos/webpush without Composer
On this page you can find all versions of the php package ngoahamos/webpush. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ngoahamos/webpush
More information about ngoahamos/webpush
Files in ngoahamos/webpush
Package webpush
Short Description Web Push notification channel for Laravel
License MIT
Informations about the package webpush
Web push notifications channel for Laravel
This package makes it easy to send web push notifications with Laravel.
Installation
You can install the package via composer:
First you must install the service provider (skip for Laravel>=5.5):
Add the NotificationChannels\WebPush\HasPushSubscriptions
trait to your User
model:
Next publish the migration with:
Run the migrate command to create the necessary table:
You can also publish the config file with:
Generate the VAPID keys (required for browser authentication) with:
This command will set VAPID_PUBLIC_KEY
and VAPID_PRIVATE_KEY
in your .env
file.
These keys must be safely stored and should not change.
If you still want support Google Cloud Messaging set the GCM_KEY
and GCM_SENDER_ID
in your .env
file.
Usage
Now you can use the channel in your via()
method inside the notification as well as send a web push notification:
Save/Update Subscriptions
To save or update a subscription use the updatePushSubscription($endpoint, $key = null, $token = null)
method on your user:
The $key
and $token
are optional and are used to encrypt your notifications. Only encrypted notifications can have a payload.
Delete Subscriptions
To delete a subscription use the deletePushSubscription($endpoint)
method on your user:
Demo
For a complete implementation with a Service Worker check this demo.
Browser Compatibility
See the Push API browser compatibility.
Changelog
Please see CHANGELOG for more information about what has changed recently.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
- Cretu Eusebiu
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of webpush with dependencies
illuminate/notifications Version ^5.3
illuminate/support Version ^5.1
minishlink/web-push Version ^2.0