2017 © Pedro Peláez
 

yii2-extension yii2-fcm-component

Very simple fcm component for yii2

image

matthew-p/yii2-fcm-component

Very simple fcm component for yii2

  • Friday, May 11, 2018
  • by hellboymxb@gmail.com
  • Repository
  • 1 Watchers
  • 1 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 650 % Grown

The README.md

Firebase cloud messaging for Yii2

Very simple FCM component for yii2, (*1)

Installation

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

Add, (*3)

"matthew-p/yii2-fcm-component": "^1.0"

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

and, (*5)

{
  "type": "git",
  "url": "https://github.com/MatthewPattell/yii2-fcm"
},
{
  "type": "git",
  "url": "https://github.com/MatthewPattell/php-fcm"
}

to the repositories section of your composer.json file., (*6)

Usage

Once the extension is installed, simply use it in your code by:, (*7)

In config main.php:, (*8)

...
'components' => [
    ...
    'fcm' => [
        'class'  => \MP\Fcm\FcmComponent::class,
        'apiKey' => 'sampleKey',
    ],
    ...
],
...

Use:, (*9)

// Send to topic
$message = [
    'topic' => 'sampleChannelID',
    'data'  => [
        'sample1' => 'test'
    ],
];

$notification = ['key' => 'samplePushMessageKey'];


Yii::$app->fcm->pushTopic($message, $notification);

// Send to device
$message = [
    'device' => 'sampleDeviceToken',
    'data'   => [
        'sample1' => 'test'
    ],
];
Yii::$app->fcm->pushDevice($message, $notification);

See $notification configuration in \MP\Fcm\FcmComponent::NOTIFICATION_DEFAULT, (*10)

That's all. Check it., (*11)

The Versions

11/05 2018

dev-master

9999999-dev

Very simple fcm component for yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Matthew Patell

component extension yii2 cloud message firebase fcm

11/05 2018

1.0

1.0.0.0

Very simple fcm component for yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Matthew Patell

component extension yii2 cloud message firebase fcm

11/05 2018

1.0.1

1.0.1.0

Very simple fcm component for yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Matthew Patell

component extension yii2 cloud message firebase fcm