2017 © Pedro Peláez
 

symfony-bundle push-server-bundle

Wassa Push Server bundle

image

wassafr/push-server-bundle

Wassa Push Server bundle

  • Friday, March 2, 2018
  • by wassafr
  • Repository
  • 3 Watchers
  • 1 Stars
  • 121 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

WassaPushServerBundle

The WassaPushServerBundle bundle allows you to send push notification to iOS and Android devices. It use a custom library to send GCM notifications and APNS-PHP for APNS notifications., (*1)

Installation

Require the wassafr/push-server-bundle package in your composer.json and update your dependencies., (*2)

$ composer require duccio/apns-php dev-master --no-update
$ composer require wassafr/push-server-bundle

Register the bundle in app/AppKernel.php:, (*3)

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Wassa\MPSBundle\MPSBundle(),
    );
}

Import the routing definition in routing.yml:, (*4)

# app/config/routing.yml
wassa_mps_api:
    resource: "@WassaMPSBundle/Controller/API/"
    type: annotation
    prefix: /api/push

To enable the configuration, we suggest to add parameters to parameters.yml.dist so that you can change them easily when you deploy the bundle to multiple servers with different configurations:, (*5)

# app/config/parameters.yml.dist
    wassa_mps_gcm_api_key:
    wassa_mps_gcm_dry_run: false
    wassa_mps_apns_environment: sandbox
    wassa_mps_apns_prod_cert: ~
    wassa_mps_apns_sand_cert: ~
    wassa_mps_apns_ca_cert: ~
    wassa_mps_entity_manager: ~
# app/config/parameters.yml
    wassa_mps_gcm_api_key: <gcm_key>
    wassa_mps_gcm_dry_run: false
    wassa_mps_apns_environment: sandbox
    wassa_mps_apns_prod_cert: <path_to_apns_prod_cert>
    wassa_mps_apns_sand_cert: <path_to_apns_sandbox_cert>
    wassa_mps_apns_ca_cert: <path_to_apns_rootca_cert>
    wassa_mps_entity_manager: ~

And finally:, (*6)

# app/config/config.yml
wassa_mps:
    gcm:
        api_key: "%wassa_mps_gcm_api_key%"
        dry_run: "%wassa_mps_gcm_dry_run%"
    apns:
        environment: "%wassa_mps_apns_environment%"
        prod_cert: "%wassa_mps_apns_prod_cert%"
        sand_cert: "%wassa_mps_apns_sand_cert%"
        ca_cert: "%wassa_mps_apns_ca_cert%"
    entity_manager: "%wassa_mps_entity_manager%"

Send Push

// AppBundle/Controller/YourController.php

$mps = $this->get('wassa_mps');
$pushData = new PushData();
$pushData->setGcmPayloadData($gcmPayloadData); // $gcmPayloadData is an associative array
$pushData->setGcmCollapseKey($gcmCollapsKey);
$pushData->setApnsText($apnsText);
$pushData->setApnsBadge($apnsBadge);
$pushData->setApnsCategory($apnsCategory);
$pushData->setApnsCustomProperties($apnsCustomProperties); // $apnsCustomProperties is an associative array
$pushData->setApnsExpiry($apnsExpiry);
$pushData->setApnsSound($apnsSound);

API

The bundle provide a simple API for device regisration. The registration service should be called in POST with the following POST data:, (*7)

{
    "registrationToken": "<GCM_REGISTRATIONID_OR_APNS_DEVICETOKEN>",
    "platform": "<ios|android>",
    "customData": <CUSTOM_JSON_DATA>
}

Events

The bundle fire the following events: * wassa_mps.registration.pre_check: right after the registration API is called but before the device is registered * wassa_mps.registration.post_check: right after the device has been registered, (*8)

The Versions

02/03 2018

dev-master

9999999-dev

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

02/03 2018

dev-develop

dev-develop

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

02/03 2018

2.0.1

2.0.1.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

01/03 2018

2.0.0

2.0.0.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

28/09 2016

1.0.9

1.0.9.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

28/09 2016

1.0.8

1.0.8.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

19/04 2016

1.0.7

1.0.7.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

19/04 2016

1.0.6

1.0.6.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

08/04 2016

1.0.5

1.0.5.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

11/03 2016

1.0.3.1

1.0.3.1

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

11/03 2016

1.0.4

1.0.4.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

15/02 2016

1.0.3

1.0.3.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

03/02 2016

1.0.2

1.0.2.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

03/02 2016

1.0.1

1.0.1.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns

02/02 2016

1.0.0

1.0.0.0

Wassa Push Server bundle

  Sources   Download

proprietary

The Requires

 

notification push gcm apns