PHP code example of ripples / aliyun-mns

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

    

ripples / aliyun-mns example snippets


use Ripples\Aliyun\MNS;

$client = new MNS([
    'accessKeyId' => 'accessKeyId',
    'accessKeySecret' => 'accessKeySecret',
    'accessOwnerId' => 'transformQueueOwner',
    'accessRegion' => 'transformQueueRegion',
    'accessQueue' => 'transformQueueName',
]);

$client->sendMessage([
    'MessageBody' => 'A message.',
    'DelaySeconds' => 0,
    'Priority' => 8
]);

$msg = $client->receiveMessage();

$client->dropMessage([
    'ReceiptHandle' => '1-ODU4OTkzNDU5My0xNDA1ODQ4OTUwLTItOA=='
]);