PHP code example of sn01615 / umeng-php
1. Go to this page and download the library: Download sn01615/umeng-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sn01615 / umeng-php example snippets
# Android
$cc = (new UmengPush('$key', '$secret'))
// ->updateTimestamp() // 更新签名使用的时间
// ->setProductionMode(false)
// ->setGetUrlAndBody(true) // 直接返回url和body
->sendAndroidCustomizedcast([
'ticker' => '1', // 必填 通知栏提示文字
'title' => '2', // 必填 通知标题
'text' => '3', // 必填 通知文字描述
// 'mipush' => true, // 离线推送
// 'mi_activity' => 'xxx.XXXActivity',
], [
'aaa' => 1111, // 可选,用户自定义key-value。只对"通知"
],
$alias = '12345', // 开发者填写自己的alias, 要求不超过500个alias, 多个alias以英文逗号间隔
$aliasType = 'XXX');
# iOS
$cc = (new UmengPush('***', '***'))
// ->updateTimestamp() // 更新签名使用的时间
// ->setProductionMode(false)
// ->setGetUrlAndBody(true) // 直接返回url和body
->sendIOSCustomizedcast([
// 'alert' => '', // 可为JSON类型和字符串类型
'alert' => [
'title' => '1',
'subtitle' => '2',
'body' => '3',
],
], [
'aaa' => 1111, // 可选,用户自定义内容, "d","p"为友盟保留字段,
// key不可以是"d","p"
], $alias = '12345', // 开发者填写自己的alias, 要求不超过500个alias, 多个alias以英文逗号间隔
$aliasType = 'XXX');
var_dump($cc);
bash
composer