PHP code example of lspbupt / yii2-jpush

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

    

lspbupt / yii2-jpush example snippets


return [
    'components' => [
        'jpush' => [
            'class' => 'lspbupt\push\Jpush',
            'app_key' => "", //极光推送的appkey
            'app_secret' => "", //极光推送的appsecret
        ],
    ],   
    // .... 
];

$result = Yii::$app->jpush->push()
    ->setPlatform('all')
    ->addAllAudience()
    ->setNotificationAlert('Hi, JPush')
    ->send();

$client = new \lspbupt\push\Jpush([
    'app_key' => $app_key,
    'app_secret' => $app_secret,
]);
$result = $client->push()
    ->setPlatform('all')
    ->addAllAudience()
    ->setNotificationAlert('Hi, JPush')
    ->send();

php composer.phar