2017 © Pedro Peláez
 

library ionic-php-pusher

PHP SDK for Ionic Push Beta

image

acurrieclark/ionic-php-pusher

PHP SDK for Ionic Push Beta

  • Sunday, May 14, 2017
  • by acurrieclark
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,156 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 15 % Grown

The README.md

Ionic Push PHP SDK Build Status

This package is a basic PHP SDK to assist with the sending of push notifications using the Ionic Push API., (*1)

Installation

$ composer require acurrieclark/ionic-php-pusher, (*2)

Usage

``` php // include autoloader if you haven't already include_once('vendor/autoload.php');, (*3)

use acurrieclark\IonicPhpPusher\Pusher; use acurrieclark\IonicPhpPusher\PusherData;, (*4)

// create an instance $pusher = new Pusher(API_JWT_TOKEN);, (*5)

// set an array of device tokens to push to. Can be a mix of Android and iOS devices $device_tokens = ["android_token", "ios_token"];, (*6)

// set which Ionic push profile you are using $profile = IONIC_PUSH_PROFILE_NAME;, (*7)

// the PusherData helper class provides a blank object to populate with notification data // it is provided for convenience. Feel free to create your own object here $notification = new PusherData();, (*8)

$notification->title = "Message Title"; $notification->message = "Message Body"; $notification->ios->sound = "Default.caf"; $notification->ios->badge = 2; $notification->android->title = "Android Title"; $notification->android->message = "Android Message"; $notification->android->data->style = 'inbox'; $notification->android->data->summaryText = "There are %n% updates"; $notification->android->sound = "default_alert";, (*9)

try {, (*10)

// API endpoint to check you are using a valid token. This is not necessary before pushing $pusher->testApiAccess();, (*11)

// send your notification and output its response $response = $pusher->sendToTokens($tokens, $profile, $notification); print_r($response);, (*12)

} catch (PusherException $e) { // any exceptions can be caught and handled here echo $e->getType().' - '.$e->getCode() .": ".$e->getMessage() . "\n";, (*13)

if ($e->hasResponse()) { print_r($e->getResponse()); } else echo "No response\n"; } ```, (*14)

License

The MIT License (MIT). Please see the License File for more information., (*15)

Thanks

Builds on the work for the Ionic Alpha API done by Vladimir Dmitrovskiy, (*16)

The Versions

14/05 2017

dev-master

9999999-dev

PHP SDK for Ionic Push Beta

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Currie-Clark

04/04 2016

v0.1

0.1.0.0

PHP SDK for Ionic Push Beta

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Currie-Clark