承接 understeam/yii2-fcm 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

understeam/yii2-fcm

最新稳定版本:v0.2.0

Composer 安装命令:

composer require understeam/yii2-fcm

包简介

Yii2 Firebase Cloud Messaging adapter

README 文档

README

This component wraps paragraph1/php-fcm library.

Installation

Preferred way to install is through Composer:

$ composer require understeam/yii2-fcm:~0.1 --prefer-dist 

Configuration

Add component to your application config:

...
'components' => [
    'fcm' => [
        'class' => 'understeam\fcm\Client',
        'apiKey' => 'your API key', // Server API Key (you can get it here: https://firebase.google.com/docs/server/setup#prerequisites) 
    ],
],
...

Usage

You can find more usage examples here.

$note = Yii::$app->fcm->createNotification("test title", "testing body");
$note->setIcon('notification_icon_resource_name')
    ->setColor('#ffffff')
    ->setBadge(1);

$message = Yii::$app->fcm->createMessage();
$message->addRecipient(new Device('your-device-token'));
$message->setNotification($note)
    ->setData(['someId' => 111]);

$response = Yii::$app->fcm->send($message);
var_dump($response->getStatusCode());

统计信息

  • 总下载量: 194.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-11