Developed with love by KnpLabs Hire us for your project!
27

webpush-bundle

by bpolaszek

Symfony Bundle: Send WebPush Notifications to your users.

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.4.*

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.

The MIT License (MIT)

Copyright (c) 2018 Beno!t POLASZEK

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
  • Add support for minishlink/web-push ^5.0
    By bpolaszek, 6 months ago
  • Example out of date in the doc. Fix #13
    By bpolaszek, 8 months ago
  • NullPushmessageSender
    By bpolaszek, 8 months ago
  • Add more keywords
    By bpolaszek, 9 months ago
  • Fix Travis build for Symfony 3
    By bpolaszek, 9 months ago
  • Fix PHPDoc
    By bpolaszek, 9 months ago
  • Registry is completely useless here
    By bpolaszek, 9 months ago
  • Fix variable name
    By bpolaszek, 9 months ago
  • Update keywords and description for packagist
    By bpolaszek, 9 months ago
  • Thank you @phpstan
    By bpolaszek, 9 months ago
  • Fix documentation
    By bpolaszek, 9 months ago
  • Merge branch '0.4.x-dev'
    By bpolaszek, 9 months ago
  • Add License
    By bpolaszek, 9 months ago
  • Badge all the things
    By bpolaszek, 9 months ago
  • Wrong variable name
    By bpolaszek, 9 months ago
  • Small README improvement
    By bpolaszek, 9 months ago
  • Fix typos
    By bpolaszek, 9 months ago
  • Add credits
    By bpolaszek, 9 months ago
  • Renamed some classes + changed UserSubscriptionManagerInterface::hash() signature
    By bpolaszek, 9 months ago
  • Improved documentation + refactoring
    By bpolaszek, 9 months ago
  • Update documentation
    By bpolaszek, 9 months ago
  • Simplified bundle configuration
    By bpolaszek, 9 months ago
  • Fix signature
    By bpolaszek, 9 months ago
  • Externalized request building
    By bpolaszek, 9 months ago
  • Removed Javascripts
    By bpolaszek, 9 months ago
  • Major changes + tests
    By bpolaszek, 9 months ago
  • Merge pull request #12 from wRLSS/master
    By web-flow, 9 months ago
  • Merge pull request #9 from franbenz/patch-1
    By web-flow, 9 months ago
  • Incorrect parameter description in services.xml #11
    By , 9 months ago
  • Service declaration
    By web-flow, 10 months ago