1 Star 0 Fork 0

mark / phpFCM

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

phpFCM

PHP application server implementation for Firebase Cloud Messaging.

#Setup The recommended way of installing is using Composer.

command line

composer require paragraph2/php-fcm

composer.json

"require": {
    "paragraph2/php-fcm": "*"
}

#Send to Device also see https://firebase.google.com/docs/cloud-messaging/downstream

use paragraph2\phpFCM\Client;
use paragraph2\phpFCM\Message;
use paragraph2\phpFCM\Recipient\Device;
use paragraph2\phpFCM\Notification;

require_once 'vendor/autoload.php';

$apiKey = 'YOUR SERVER KEY';
$client = new Client();
$client->setApiKey($apiKey);
$client->injectHttpClient(new \GuzzleHttp\Client());

$note = new Notification('test title', 'testing body');
$note->setIcon('notification_icon_resource_name')
    ->setColor('#ffffff')
    ->setBadge(1);

$message = new Message();
$message->addRecipient(new Device('your-device-token'));
$message->setNotification($note)
    ->setData(array('someId' => 111));

$response = $client->send($message);
var_dump($response->getStatusCode());

#Send to topic also see https://firebase.google.com/docs/cloud-messaging/topic-messaging

use paragraph2\phpFCM\Client;
use paragraph2\phpFCM\Message;
use paragraph2\phpFCM\Recipient\Topic;
use paragraph2\phpFCM\Notification;

require_once 'vendor/autoload.php';


$apiKey = 'YOUR SERVER KEY';
$client = new Client();
$client->setApiKey($apiKey);
$client->injectHttpClient(new \GuzzleHttp\Client());

$message = new Message();
$message->addRecipient(new Topic('your-topic'));
$message->setNotification(new Notification('test title', 'testing body'))
    ->setData(array('someId' => 111));

$response = $client->send($message);
var_dump($response->getStatusCode());

空文件

简介

copy from paragraph1/php-fpm 展开 收起
PHP
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/estudyer/phpFCM.git
git@gitee.com:estudyer/phpFCM.git
estudyer
phpFCM
phpFCM
master

搜索帮助