bentools / webpush-bundle
Send push notifications through Web Push Protocol to your Symfony users.
Installs: 181 246
Dependents: 1
Suggesters: 0
Security: 0
Stars: 66
Watchers: 10
Forks: 40
Open Issues: 9
Type:symfony-bundle
Requires
- php: >=8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- guzzlehttp/guzzle: ^6.5.8|^7.4
- minishlink/web-push: ~6.0|~7.0|~8.0
- symfony/http-kernel: ^4.4.50|^5.4.20|^6.0
Requires (Dev)
- bentools/doctrine-static: 1.0.x-dev
- doctrine/dbal: ~2.5 <=2.9
- nyholm/symfony-bundle-test: ~1.8
- phpunit/phpunit: ^8.5.38|~9.0
- symfony/config: ~4.0|~5.0|~6.0
- symfony/dependency-injection: ~3.0|~4.0|~5.0|~6.0
- symfony/framework-bundle: ~3.0|~4.0|~5.0|~6.0
- symfony/http-foundation: ~3.0|~4.0|~5.0|~6.0
- symfony/routing: ~3.0|~4.0|~5.0|~6.0
- symfony/security: ~3.0|~4.0|~5.0|~6.0
- symfony/var-dumper: ~3.0|~4.0|~5.0|~6.0
- symfony/yaml: ~3.0|~4.0|~5.0|~6.0
- twig/twig: ~1.0|~2.0
- web-token/jwt-util-ecc: >=2.1
README
Webpush Bundle
This bundle allows your app to leverage the Web Push protocol to send notifications to your users' devices, whether they're online or not.
With a small amount of code, you'll be able to associate your Symfony users to WebPush Subscriptions:
- A single user can subscribe from multiple browsers/devices
- Multiple users can subscribe from a single browser/device
This bundle uses your own persistence system (Doctrine or anything else) to manage these associations.
We assume you have a minimum knowledge of how Push Notifications work, otherwise we highly recommend you to read Matt Gaunt's Web Push Book.
Example Use cases
- You have a todolist app - notify users they're assigned a task
- You have an eCommerce app:
- Notify your customer their order has been shipped
- Notify your category manager they sell a product
Summary
- Installation
- The UserSubscription entity
- The UserSubscription manager
- Configure the bundle
- Enjoy!
- F.A.Q.
Getting started
This bundle is just the back-end part of the subscription process. For the front-end part, have a look at the webpush-client package.
Composer is your friend:
PHP8.1+ is required.
composer require bentools/webpush-bundle
⚠️ We aren't on stable version yet - expect some changes.
Generate your VAPID keys:
php bin/console webpush:generate:keys
You'll have to update your config with the given keys. We encourage you to store them in environment variables or in parameters.yml
.
Next: Create your UserSubscription class
Tests
./vendor/bin/phpunit
License
MIT
Credits
This bundle leverages the minishlink/web-push library.