gigadrive/webpush-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Send push notifications through Web Push Protocol to your Symfony users.

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 35

Type:symfony-bundle

0.6 2020-05-07 06:17 UTC

This package is auto-updated.

Last update: 2023-10-08 01:34:00 UTC


README

Latest Stable Version License Build Status Quality Score Total Downloads

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

  1. Installation
  2. The UserSubscription entity
  3. The UserSubscription manager
  4. Configure the bundle
  5. Enjoy!
  6. 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:

PHP7.1+ is required.

composer require bentools/webpush-bundle 0.6.*

If you're using Symfony 3, add the bundle to your kernel. With Symfony Flex, this should be done automatically.

⚠️ 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.