erickskrauch/fcm 问题修复 & 功能扩展

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

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

erickskrauch/fcm

最新稳定版本:0.3.0

Composer 安装命令:

composer require erickskrauch/fcm

包简介

PHP application server for google firebase cloud messaging (FCM)

README 文档

README

Just another client to send push notifications via Firebase Cloud Messaging (FCM). The implementation is inspired by Paragraph1/php-fcm and its fork guigpm/php-fcm, but heavily reworked in favor of simpler code and better implementation.

Latest Version on Packagist Build Status Changelog PHP version Software License

Installation

This library relies on PSR-18 which defines how HTTP message should be sent and received. You can use any library to send HTTP messages that implements psr/http-client-implementation. Read more about PSR-18 in this blog.

To install this library with Guzzle you may run the following command:

composer require erickskrauch/fcm guzzlehttp/guzzle

Or using the curl client (you'll need to provide a PSR7 implementation such as nyholm/psr7 if not using Guzzle):

composer require erickskrauch/fcm php-http/curl-client nyholm/psr7

Usage

The component's constructor allows you to explicitly pass all dependencies. But you can also pass only the mandatory API token, and all other dependencies will be found automatically. The example below relies on auto discovery.

use ErickSkrauch\Fcm\Client;
use ErickSkrauch\Fcm\Message\Message;
use ErickSkrauch\Fcm\Message\Notification;
use ErickSkrauch\Fcm\Recipient\Device;

$client = new Client('SERVICE ACCOUNT OAUTH TOKEN', 'project-x146w');

$notification = new Notification(, 'testing body');
$notification->setTitle('Wow, something happened...');
$notification->setBody('It just works!');

$message = new Message();
$message->setNotification($notification);
$message->setCollapseKey('collapse.key');

$recipient = new Device('your-device-token'); // or new ErickSkrauch\Fcm\Recipient\Topic('topic');

$result = $client->send($message, $recipient);

Contribute

This library in an Open Source under the MIT license. It is, thus, maintained by collaborators and contributors.

Feel free to contribute in any way. As an example you may:

  • Trying out the master code.
  • Create issues if you find problems.
  • Reply to other people's issues.
  • Review PRs.

Ensuring code quality

The project has several tools for quality control. All checks are performed in CI, but if you want to perform checks locally, here are the necessary commands:

vendor/bin/php-cs-fixer fix -v
vendor/bin/phpstan analyse
vendor/bin/phpunit
vendor/bin/infection # Try "env XDEBUG_MODE=coverage vendor/bin/infection" in case of errors

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固