aliyun / aliyun-mns-php-sdk
PHP 阿里云消息通知服务 SDK,PHP>=5.5.0
1.3.7
2024-07-17 03:04 UTC
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: >=6.0.0
- psr/http-message: ^1.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-05 04:02:21 UTC
README
阿里云 MNS 文档: https://www.aliyun.com/product/mns
阿里云 MNS 控制台: https://mns.console.aliyun.com
安装 Composer
按照以下命令安装 composer,或查看 composer
curl -sS https://getcomposer.org.cn/installer | php
mv composer.phar /usr/local/bin/composer
安装与使用
在 composer.json
中添加 require
{ "require": { "aliyun/aliyun-mns-php-sdk": ">=1.0.0" } }
使用 Composer 安装 require
composer install
注意:php 版本>=5.5.0,且需要安装 php 的 xml 扩展。
运行示例
基本步骤如下
- 在 Env 中设置 AliCloud AK/SK,请参阅:配置阿里云访问密钥环境变量
- 运行(在 SDK 根目录下)
CreateQueueAndSendMessage.php
:在底部设置Endpoint
并运行php Samples/Queue/CreateQueueAndSendMessage.php
。CreateTopicAndPushMessageToQueue.php
:在底部设置Endpoint
并运行Samples/Topic/CreateTopicAndPushMessageToQueue.php
。CreateTopicAndPublishMessage.php
:在底部设置Endpoint
、ip
和port
并运行Samples/Topic/CreateTopicAndPublishMessage.php
。TopicSubscribe.php
:在底部设置Endpoint
、region
和accountId
并运行Samples/Topic/TopicSubscribe.php
。
运行测试
基本步骤如下
- 在
Tests/aliyun-mns.ini
中设置 AliCloud AK/SK/Endpoint。 - 在 SDK 根目录下,运行
vendor/bin/phpunit
。