2017 © Pedro Peláez
 

symfony-bundle rms-push-notifications-bundle

Push notifications/messages for mobile devices

image

ddlzz/rms-push-notifications-bundle

Push notifications/messages for mobile devices

  • Friday, July 13, 2018
  • by ddlzz
  • Repository
  • 0 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 145 Forks
  • 0 Open issues
  • 20 Versions
  • 0 % Grown

The README.md

RMSPushNotificationsBundle

A bundle to allow sending of push notifications to mobile devices. Currently supports Android (C2DM, GCM), Blackberry and iOS devices., (*1)

Installation

To use this bundle in your Symfony2 project add the following to your composer.json:, (*2)

{
    "require": {
        // ...
        "richsage/rms-push-notifications-bundle": "dev-master"
    }
}

and enable it in your kernel:, (*3)

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new RMS\PushNotificationsBundle\RMSPushNotificationsBundle(),
    );
}

NOTE: If you are still using Symfony 2.0, please use the symfony2.0 branch., (*4)

Configuration

Configuration options available are as follows. Note that the specific services will only be available if you provide configuration respectively for them., (*5)

rms_push_notifications:
  android:
      timeout: 5 # Seconds to wait for connection timeout, default is 5
      c2dm:
          username: <string_android_c2dm_username>
          password: <string_android_c2dm_password>
          source: <string_android_c2dm_source>
      gcm:
          api_key: <string_android_gcm_api_key> # This is titled "Server Key" when creating it
          use_multi_curl: <boolean_android_gcm_use_multi_curl> # default is true
          dry_run: <bool_use_gcm_dry_run>
  ios:
      timeout: 60 # Seconds to wait for connection timeout, default is 60
      sandbox: <bool_use_apns_sandbox>
      pem: <path_apns_certificate> # can be absolute or relative path (from app directory)
      passphrase: <string_apns_certificate_passphrase>
  mac:
      timeout: 60 # Seconds to wait for connection timeout, default is 60
      sandbox: <bool_use_apns_sandbox>
      pem: <path_apns_certificate>
      passphrase: <string_apns_certificate_passphrase>
  blackberry:
      timeout: 5 # Seconds to wait for connection timeout, default is 5
      evaluation: <bool_bb_evaluation_mode>
      app_id: <string_bb_app_id>
      password: <string_bb_password>
  windowsphone:
      timeout: 5 # Seconds to wait for connection timeout, default is 5

NOTE: If you are using Windows, you may need to set the Android GCM use_multi_curl flag to false for GCM messages to be sent correctly., (*6)

Timeout defaults are the defaults from prior to the introduction of this configuration value., (*7)

Usage

A little example of how to push your first message to an iOS device, we'll assume that you've set up the configuration correctly:, (*8)

use RMS\PushNotificationsBundle\Message\iOSMessage;

class PushDemoController extends Controller
{
    public function pushAction()
    {
        $message = new iOSMessage();
        $message->setMessage('Oh my! A push notification!');
        $message->setDeviceIdentifier('test012fasdf482asdfd63f6d7bc6d4293aedd5fb448fe505eb4asdfef8595a7');

        $this->container->get('rms_push_notifications')->send($message);

        return new Response('Push notification send!');
    }
}

The send method will detect the type of message so if you'll pass it an AndroidMessage it will automatically send it through the C2DM/GCM servers, and likewise for Mac and Blackberry., (*9)

Android messages

Since both C2DM and GCM are still available, the AndroidMessage class has a small flag on it to toggle which service to send it to. Use as follows:, (*10)

use RMS\PushNotificationsBundle\Message\AndroidMessage;

$message = new AndroidMessage();
$message->setGCM(true);

to send as a GCM message rather than C2DM., (*11)

iOS Feedback service

The Apple Push Notification service also exposes a Feedback service where you can get information about failed push notifications - see here for further details., (*12)

This service is available within the bundle. The following code demonstrates how you can retrieve data from the service:, (*13)

$feedbackService = $container->get("rms_push_notifications.ios.feedback");
$uuids = $feedbackService->getDeviceUUIDs();

Here, $uuids contains an array of Feedback objects, with timestamp, token length and the device UUID all populated., (*14)

Apple recommend you poll this service daily., (*15)

Windows Phone - Toast support

The bundle has beta support for Windows Phone, and supports the Toast notification. Use the WindowsphoneMessage message class to send accordingly., (*16)

Thanks

Firstly, thanks to all contributors to this bundle!, (*17)

, (*18)

Secondly, thanks to JetBrains for their sponsorship of an open-source PhpStorm licence for this project., (*19)

The Versions

13/07 2018

dev-master

9999999-dev https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

08/04 2018

dev-fcm

dev-fcm https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

01/03 2017

0.2.3

0.2.3.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

15/04 2016

dev-remove-c2dm

dev-remove-c2dm https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

26/03 2016

0.2.2

0.2.2.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

24/03 2016

0.2.1

0.2.1.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

24/03 2016

0.2.0

0.2.0.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

21/08 2015

0.1.9

0.1.9.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

29/06 2015

0.1.8

0.1.8.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

08/06 2015

0.1.7

0.1.7.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

14/05 2015

0.1.6

0.1.6.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

02/04 2015

0.1.5

0.1.5.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

02/03 2015

0.1.4

0.1.4.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

02/01 2015

0.1.3

0.1.3.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns mpns c2dm blackberry windowsphone

23/01 2014

0.1.2

0.1.2.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns c2dm blackberry

04/11 2013

0.1.1

0.1.1.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns c2dm blackberry

09/10 2013

dev-windows-mobile

dev-windows-mobile https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns c2dm blackberry

30/09 2013

dev-add-logger

dev-add-logger https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle notification ios push gcm apns c2dm blackberry

05/09 2013

0.1.0

0.1.0.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns c2dm blackberry

05/03 2013

dev-symfony2.0

dev-symfony2.0 https://github.com/richsage/RMSPushNotificationsBundle

Push notifications/messages for mobile devices

  Sources   Download

MIT

The Requires

 

bundle notification ios push gcm apns c2dm blackberry