erdouing/umeng
最新稳定版本:v1.0
Composer 安装命令:
composer require erdouing/umeng
包简介
友盟推送
README 文档
README
友盟推送SDK
Installing
$ composer require erdouing/umeng -vvv
配置
在使用本扩展之前,你需要去 友盟+ 注册账号,然后创建应用,获取应用的 Key 和秘钥。
使用
require __DIR__ .'/vendor/autoload.php';
use Cheney\Umeng\Android;
use Cheney\Umeng\IOS;
// Android
$config = [
'appKey' => 'xxx**************',
'appMasterSecret' => 'xxxx************',
'production_mode' => true,
];
// IOS
$ios_config = [
'appKey' => 'xxx************',
'appMasterSecret' => 'xxx*********',
'production_mode' => true,
];
$android = new Android($config);
$ios = new IOS($ios_config);
Android
customizedcast消息发送示例
$params = [
'alias_type' => 'APP',
'alias' => 1,
"ticker" => "测试提示文字",
"title" => "测试标题",
"text" => "测试文字描述",
"after_open" => "go_app",
"description" => "测试广播通知-Android",
];
$response = $android->sendAndroidCustomizedcast($params);
broadcast消息发送示例
$params = [
"ticker" => "测试提示文字",
"title" => "测试标题",
"text" => "测试文字描述",
"after_open" => "go_app",
];
$extra = [
'key1' => 'val1',
'key2' => 'val2',
];
$response = $android->sendAndroidBroadcast($params, $extra);
unicast消息发送示例
$params = [
"device_tokens" => "测试提示文字",
"display_type" => "notification", // message:消息 notification:通知
//"custom" => '自定义custom',
//以下内容为 notification 必填项
"ticker" => "测试提示文字",
"title" => "测试标题",
"text" => "测试文字描述",
"after_open" => "go_app",
];
//可选项
$extra = [
'key1' => 'val1',
'key2' => 'val2',
];
$response = $android->sendAndroidUnicast($params, $extra);
filecast消息发送示例
$params = [
"ticker" => "测试提示文字",
"title" => "测试标题",
"text" => "测试文字描述",
"after_open" => "go_app",
];
//
$content = "aa" . "\n" . "bb";
$response = $android->sendAndroidFilecast($params, $content);
groupcast消息发送示例
$params = [
"ticker" => "测试提示文字",
"title" => "测试标题",
"text" => "测试文字描述",
"after_open" => "go_app",
];
//
$filter = [
'where' => [
'and' => [
'tag' => 'test',
'tag1' => 'test2',
],
],
];
$response = $android->sendAndroidGroupcast($filter, $params);
sendAndroidCustomizedcastFileId 消息示例
$params = [
"ticker" => "测试提示文字",
"title" => "测试标题",
"text" => "测试文字描述",
"after_open" => "go_app",
'alias_type' => 'APP',
];
$content = "aa" . "\n" . "bb";
$response = $android->sendAndroidCustomizedcastFileId($params, $content);
IOS
broadcast消息发送示例
$params = [
'alert' => [
'title' => 'title',
'body' => 'body',
], //字符串或者JSON
"description" => "测试广播通知-iOS"
];
$customized = [
'key' => 'jey',
]; //可选
$response = $ios->sendIOSBroadcast($params, $customized);
unicast消息发送示例
$params = [
'device_tokens' => 'token',
'alert' => [
'title' => 'title',
'body' => 'body',
], //字符串或者JSON
"description" => "测试单播消息-iOS"
];
$customized = [
'key' => 'jey',
]; //可选
$response = $ios->sendIOSUnicast($params, $customized);
filecast消息发送示例
$params = [
'device_tokens' => 'token',
'alert' => [
'title' => 'title',
'body' => 'body',
], //字符串或者JSON
"description" => "测试filecast文件通知-iOS"
];
$content = "aa" . "\n" . "bb";
$response = $ios->sendIOSFilecast($params, $content);
groupcast消息发送示例
$params = [
'alert' => [
'title' => 'title',
'body' => 'body',
], //字符串或者JSON
"description" => "测试组播通知-iOS"
];
$filter = [
'where' => [
'and' => [
'tag' => 'test',
'tag1' => 'test2',
],
],
];
$response = $ios->sendIOSGroupcast($filter, $params);
customizedcast消息发送示例
$params = [
'alert' => [
'title' => 'title',
'body' => 'body',
], //字符串或者JSON
'alias_type' => 'APP',
'alias' => 1,
"description" => "测试alias通知-iOS"
];
$response = $ios->sendIOSCustomizedcast($params);
sendIOSCustomizedcastFileId消息发送示例
$params = [
'alert' => [
'title' => 'title',
'body' => 'body',
], //字符串或者JSON
'alias_type' => 'APP',
"description" => "测试Customized通知-iOS"
];
$content = "aa" . "\n" . "bb";
$response = $ios->sendIOSCustomizedcastFileId($params, $content);
参考
工具
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-04
