定制 juniorlemes/fcm-php-http-v1 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

juniorlemes/fcm-php-http-v1

最新稳定版本:v0.0.1

Composer 安装命令:

composer require juniorlemes/fcm-php-http-v1

包简介

This package fork has pluritech/fcm-php, https://github.com/Pluritech/fcm-php Portable PHP 5.3

README 文档

README

This repository contains the open source PHP SDK that allows you to access the Google FCM Platform from your PHP app.

Installation

The Google FCM PHP SDK can be installed with Composer. Run this command:

    composer require juniorlemes/fcm-php-http-v1

Usage

Note: This version of the Google FCM SDK for PHP requires PHP 5.4 or greater.

Simple Send push example.

require_once __DIR__ . '/vendor/autoload.php'; // change path as needed

$FCMPHP = new \FCMPHP\FCMPHP([
    'fcm_server_key' => '{server-key}'
]);

$FCMNotification = new \FCMPHP\FCMNotification();

$FCMNotification->setTitle('{push-title}');
$FCMNotification->setBody('{push-description}');
$FCMNotification->setPriority('{push-priority}'); //high or normal
$FCMNotification->setDevices([ 
     '{device-id}'
    ,'{device-id}'
]); //One or more devices

$request = $FCMPHP->send($FCMNotification);

//Http error
if($request->getHttpStatusCode() != 200){
    $code = $request->getHttpStatusCode();
    $body = $request->getBody();
}

//One or more failure on send push to FCM
if($failure = $request->hasFailure()){
    $count = $failure['count'];
    $error = $failure['error'];
}

Documentation

In progress.

Tests

In progress.

Contributing

Feel free to make your pull request, chip in to suggestion or report issues.

License

MIT © Guilherme Valentim

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-26