Skip to content

aliyun/aliyun-mns-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MNS SDK for PHP

Aliyun MNS Documents: https://www.aliyun.com/product/mns

Aliyun MNS Console: https://mns.console.aliyun.com

Intall Composer

To install composer by following commands, or see composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Install & Use

Add require to your composer.json

{
  "require": {
     "aliyun/aliyun-mns-php-sdk": ">=1.0.0"
  }
}

Use Composer to install requires

composer install

Note: php version>=5.5.0, and xml extension of php is required.

Run the Samples

Queue Sample
Topic Sample

The basic steps are:

  1. Set AliCloud AK/SK In Env, please see: configure-the-alibaba-cloud-accesskey-environment
  2. Run (In the SDK root directory):
    • CreateQueueAndSendMessage.php : Set the Endpoint at the bottom and Run php Samples/Queue/CreateQueueAndSendMessage.php.
    • CreateTopicAndPushMessageToQueue.php : Set the Endpoint at the bottom and Run Samples/Topic/CreateTopicAndPushMessageToQueue.php.
    • CreateTopicAndPublishMessage.php : Set the Endpoint, ip and port at the bottom and Run Samples/Topic/CreateTopicAndPublishMessage.php.
    • TopicSubscribe.php : Set the Endpoint, region and accountId at the bottom and Run Samples/Topic/TopicSubscribe.php.

Run the Tests

The basic steps are:

  1. Set AliCloud AK/SK/Endpoint In Tests/aliyun-mns.ini.
  2. In the SDK root directory, run vendor/bin/phpunit.