/web-push-bundle

Bundle around the WebPush library

Primary LanguagePHPMIT LicenseMIT

MinishlinkWebPushBundle

This bundle provides a simple integration of the WebPush library.

SensioLabsInsight

Usage

Web Push sends notifications to endpoints which server delivers web push notifications as described in the Web Push API specification.

<?php
/** @var \Minishlink\WebPush\WebPush */
$webPush = $this->container->get('minishlink_web_push');

The bundle provides a new minishlink_web_push service that returns an instance of Minishlink\WebPush\WebPush.

For more info on what you can do with $webPush, check Minishlink/web-push.

Installation

  1. composer require minishlink/web-push-bundle
  2. Enable the bundle in your app/AppKernel.php.
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Minishlink\Bundle\WebPushBundle\MinishlinkWebPushBundle(),
        // ...
    );
}

Configuration

Here is the default configuration, you may change it in your app/config/config.yml.

minishlink_web_push:
  api_keys: # you should put api keys in your "app/config/parameters.yml" file
    GCM: ''
  ttl: 2419200 # Time to Live of notifications in seconds
  urgency: ~ # can be very-low / low / normal / high
  topic: ~ # default identifier for your notifications
  timeout: 30 # Timeout of each request in seconds
  automatic_padding: true # pad messages automatically for better security (against more bandwith usage)