2017 © Pedro Peláez
 

yii2-extension yii2-gcm-apns

Yii2 component as wrapper of the "albaraam/php-gcm-apns" library to handle mobile push notifications.

image

albaraam/yii2-gcm-apns

Yii2 component as wrapper of the "albaraam/php-gcm-apns" library to handle mobile push notifications.

  • Thursday, July 14, 2016
  • by albaraam
  • Repository
  • 1 Watchers
  • 0 Stars
  • 999 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 11 % Grown

The README.md

albaraam/yii2-gcm-apns

Yii2 component as wrapper of the "albaraam/php-gcm-apns" library to handle mobile push notifications., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

composer require albaraam/yii2-gcm-apns "~1.0.0"

or add, (*4)

"albaraam/yii2-gcm-apns": "~1.0.0"

to the require section of your composer.json., (*5)

Usage

Add & configure the component in your config file:, (*6)

'components' => [
    'gcmApns' => [
        'class' => 'albaraam\yii2_gcm_apns\GcmApns',
        'google_api_key'=>'your_google_api_key',
        'environment'=>\albaraam\yii2_gcm_apns\GcmApns::ENVIRONMENT_SANDBOX,
        'pem_file'=>'path/to/pem/file'
    ],
]

Access it anywhere in your application like the following:, (*7)

// Message creation through the message builder.
$message = Yii::$app()->gcmApns->messageBuilder("Title","Body");

// Common attributes for both ios and android
$message
    ->setTitle("Title")
    ->setBody("Body")
    ->setSound("sound.mp3")
    ->setData(['foo'=>'bar']);

// Android specific attributes
$message->android
    ->setTo("ids")
    ->setIcon("icon")
    ->setCollapseKey("collapse_key")
    ->setColor("#333");

// IOS specific attributes
$message->ios
    ->setTo("ids")
    ->setSound("sound_ios.mp3") // custom sound for ios
    ->setBadge(3);

// Send message
Yii::$app->gcmApns->send($message);

The Versions

14/07 2016

dev-master

9999999-dev

Yii2 component as wrapper of the "albaraam/php-gcm-apns" library to handle mobile push notifications.

  Sources   Download

MIT License

The Requires

 

by Albaraa Mishlawi

yii2 push gcm apns yii2-gcm-apns

10/12 2015

v1.0.0

1.0.0.0

Yii2 component as wrapper of the "albaraam/php-gcm-apns" library to handle mobile push notifications.

  Sources   Download

MIT License

The Requires

 

by Albaraa Mishlawi

yii2 push gcm apns yii2-gcm-apns