PHP code example of xiaodi / mobpush

1. Go to this page and download the library: Download xiaodi/mobpush 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/ */

    

xiaodi / mobpush example snippets


# 配置包路径,注意,这里 `../mobpush-websdkv3-php-master` 为相对路径,不要弄错了
$ composer config repositories.mobpush path ../mobpush-websdkv3-php-master    

#安装扩展包
$ composer 

   $mobPushConfig = new MobPushConfig();
   $mobPushConfig::$appkey = 'appkey';
   $mobPushConfig::$appSecret = 'appSecret';

use MobTech\MobPush\Config\MobPushConfig;
use MobTech\MobPush\Client\Push\PushV3Client;

$mobPushConfig = new MobPushConfig();
$mobPushConfig::$appkey = 'appkey';
$mobPushConfig::$appSecret = 'appSecret';

/* Registration ID推送 */
(new PushV3Client())->pushByRids('', 'push title', 'push content', 'rids');

use MobTech\MobPush\Config\MobPushConfig;
use MobTech\MobPush\Client\Stats\StatsV3Client;

$mobPushConfig = new MobPushConfig();
$mobPushConfig::$appkey = 'appkey';
$mobPushConfig::$appSecret = 'appSecret';

/* 根据workId查询统计结果 */ 
(new StatsV3Client())->getStatsByWorkId('workId');