bigbank/gcm-message 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bigbank/gcm-message

Composer 安装命令:

composer require bigbank/gcm-message

包简介

A PHP library to send messages to devices registered through Google Cloud Messaging

README 文档

README

A PHP library to send messages to devices registered through Google Cloud Messaging

See GCM documentation: http://developer.android.com/guide/google/gcm/index.html

Example usage

use Bigbank\Gcm\Sender;
use Bigbank\Gcm\Message;

$sender = new Sender("YOUR GOOGLE API KEY", $GcmEndpoint);

$message = new Message(
        ["device_registration_id1", "device_registration_id2"],
        ["data1" => "123", "data2" => "string"]
);

$message
    ->notification(["title" => "foo", "body" => "bar"])
    ->setCollapseKey("collapse_key")
    ->setDelayWhileIdle(true)
    ->setTtl(123)
    ->setRestrictedPackageName("com.example")
    ->setDryRun(true)
;

try {
    $response = $sender->send($message);
} catch (\Exception $exception) {
    throw new \Exception($exception->getMessage());
}

Note about cURL SSL verify peer option

Library has turned off CURLOPT_SSL_VERIFYPEER by default, but you can enable it by passing third parameter into constructor of Sender class.

You need to download root certificates and add them somewhere into your project directory. Then construct Sender object like this:

use Bigbank\Gcm\Sender;

$sender = new Sender("YOUR GOOGLE API KEY", $GcmEndpoint, "/path/to/cacert.crt");

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

  • [Bigbank's developers][link-bb-developers]
  • [All Contributors][link-contributors]

License

The Apache 2 License. Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2016-06-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固