jujiang/jjpush

There is no license information available for the latest version (dev-master) of this package.

dev-master 2024-06-18 08:21 UTC

This package is not auto-updated.

Last update: 2025-06-30 18:43:45 UTC


README

Getting started

$ composer require jujiang/jjpush

Usage

// 目前支持 华为,小米,vivo,oppo,如果只用部分,config删除对应配置
$push = new PushManage([
        'hms' => [
        'appid' => 'xxxx',
        'client_id' => 'xxxx',
        'client_secret' => 'xxxx',
    ],
    // 不匹配的机型,全部走小米推送
    'xm' => [
        'android' => [
            'package' => 'xxx',
            'app_secret' => 'xxxx'
        ]
    ],
    'vivo' => [
        'appid' => 'xxxxx',
        'app_key' => 'xxxx',
        'app_secret' => 'xxxxxx',
        'env' => 1, // 0 正式  1测试
    ],
    'oppo' => [
        'app_key' => 'xxxx',
        'app_secret' => 'xxxxxx',
    ],
    // 仅支持ios应用
    'umeng' => [
        'app_key' => 'xxxx',
        'app_secret' => 'xxxxxx',
    ]
], 'jujiang://push');

// 广播
$push->setTitle('测试标题')->setContent('测试内容')->setExtra(['a' => 1, 'b' => 2])->push();

// 别名发送
$push->setTitle('您收到一条消息')->setContent('今天天气真好')->setExtra(['a' => 444, 'b' => 55555])->pushAlias('aaaaaaa');

// 标签发送
$push->setTitle('测试标题22')->setContent('测试内容33')->setExtra(['a' => 1, 'b' => 2])->pushTag('aaaaaaa');

// 设置别名 OPPO
$push->setAlias("aaaaaaa", "CN_d3f9b29f401457966009a3feb9849e0f", 'oppo');

// 设置tag OPPO
$push->unsetAlias("aaaaaaa", 'oppo');

// 取消别名 OPPO
$push->setTag("aaaaaaa", 'CN_d3f9b29f401457966009a3feb9849e0f', 'oppo');

// 取消tag OPPO
$push->unsetTag("aaaaaaa", 'CN_d3f9b29f401457966009a3feb9849e0f', 'oppo');