# app/config/config.yml (SF3)
# config/packages/bentools_webpush.yaml (SF4)
bentools_webpush:
settings:
# subject: <URI>
public_key: 'your_public_key'
private_key: 'your_private_key'
The subject is optional, with a fallback being router.request_context.host
.
You may need to define it explicitly if you are working in a CLI context.
Note that Apple requires the subject to be an URL or a mailto URL.
# app/config/routing.yml (SF3)
# config/routing.yaml (SF4)
bentools_webpush:
resource: '@WebPushBundle/Resources/config/routing.xml'
prefix: /webpush
You will have a new route called bentools_webpush
which will be the Ajax endpoint for handling subscriptions (POST requests) / unsubscriptions (DELETE requests).
Your VAPID public key is now exposed through Twig's bentools_webpush.server_key
global variable.
To handle subscriptions/unsubscriptions on the front-end side, have a look at webpush-client.
Previous: The UserSubscription Manager
Next: Usage