This bundle leverages minishlink/web-push library to associate your Symfony users with Webpush subscriptions.
This way you can integrate push messages into your app to send notifications.
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.
- 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
- Installation
- The UserSubscription entity
- The UserSubscription manager
- Configure the bundle
- Enjoy!
- F.A.Q.
Because there can be different User implementations, and that some front-end is implied, there are several steps to follow to get started:
- Install the bundle and its assets
- Create your own
UserSubscription
class and its associated manager - Update your
config.yml
androuting.yml
- Insert a JS snippet in your twig views.
Let's go!
PHP7.1+ is required.
composer require bentools/webpush-bundle 0.3.*
We aren't on stable version yet - expect some changes.
# app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// ...
new BenTools\WebPushBundle\WebPushBundle(),
];
return $bundles;
}
}
php bin/console assets:install --symlink
We provide a service worker and a JS client.
php bin/console webpush:generate:keys
Next: Create your UserSubscription class
We mostly need functionnal tests. Contributions are very welcome!
MIT