sinergy84/push-notification-php-library
Composer 安装命令:
composer require sinergy84/push-notification-php-library
包简介
Send push notification to android|ios devices , support APNs, FCM
README 文档
README
Standalone PHP library for easy devices message notifications push.
Feel free to contribute!
Installation
composer require sinergy84/push-notification-php-library
composer dump-autoload -o
This repository uses PSR-0 autoload. After installation with composer please adjust you autoloading config if needed or include vendor/autoload.php in your index.php.
Requirements:
- PHP 5.6+
- PHP Curl and OpenSSL modules
available supports:
- APNS (Apple)
- GCM (Android) and FCM (Android)
Setting
-
settings of your provider (Apn, Fcm) at .env (make sure you renamed the .env.example to .env and filled all the requirements)
-
path to .env file (optional): set custom $path parameter in
src/PushNotification/Setting::__construct($path = NULL)to the .env file if it's not in the root dir of this library
How to use :
include_once "vendor/autoload.php"; use PushNotification\Service\PushService; use PushNotification\Settings; $data = array( 'device' => array( 'name' => '', // Android or AppleIOS 'token' => '', // device token | user token , if you want to send to apple device you have to fill this 'id' => 'unique id here'), 'message' => array( 'action' => 'test', 'title' => 'this is test title', 'targets' => array(''), // if you want to use Fcm you can inclue array of targets 'body' => 'this is body', 'type' => '', // AndroidMessages or IOSMessages 'data' => array('type' => 'testType')) ); // new Settings('path_to_env_file_if_not_library_root_dir'); new Settings(); $response = PushService::getInstance()->send($data);
Android :
include_once "vendor/autoload.php"; use PushNotification\Service\PushService; $data = array( 'device' => array( 'name' => 'Android', 'token' => '', 'id' => 'some id here '), 'message' => array( 'action' => 'test', 'title' => 'this is test title', 'targets' => array('token1', 'token2', 'token3'), 'body' => 'this is body', 'type' => 'AndroidMessages', 'data' => array('type' => 'testType')) ); // new Settings('path_to_env_file_if_not_library_root_dir'); new Settings(); $response = PushService::getInstance()->send($data); print_r($response);
IOS :
include_once "vendor/autoload.php"; use PushNotification\Service\PushService; $data = array( 'device' => array( 'name' => 'AppleIOS', 'token' => 'token', 'id' => 'BECDSx'), 'message' => array( 'action' => 'test', 'title' => 'this is test title', 'targets' => array(), 'body' => 'this is body', 'type' => 'IOSMessages', 'data' => array('type' => 'testType')) ); // new Settings('path_to_env_file_if_not_library_root_dir'); new Settings(); $response = PushService::getInstance()->send($data); print_r($response);
sinergy84/push-notification-php-library 适用场景与选型建议
sinergy84/push-notification-php-library 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 502 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「message」 「apple」 「notification」 「push」 「iphone」 「android」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sinergy84/push-notification-php-library 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sinergy84/push-notification-php-library 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sinergy84/push-notification-php-library 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package makes it easy to send notifications via AfricasTalking with Laravel
PHP AMQP Binding Library
A simple library to decode and parse Apple Sign In client tokens.
Apple Push Notification & Feedback Provider
Throttle notifications on a per-channel basis
Extensible library for building notifications and sending them via different delivery channels.
统计信息
- 总下载量: 502
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-22