SMQ SDK for PHP overview
Simple Message Queue (SMQ) SDK for PHP lets you manage queues and topics programmatically. This topic covers SDK installation, version information, and sample code.
Prerequisites
Before you begin, make sure that you have Composer installed (recommended for dependency management).
Install the SDK
Select a version based on your business requirements before you install SMQ SDK for PHP.
Install with Composer (recommended)
Run the following command in your project directory:
composer require aliyun/aliyun-mns-php-sdkFor version details and dependency information, see the aliyun-mns-php-sdk page on Packagist.
Install from GitHub
Download a specific release from the aliyun-mns-php-sdk releases page on GitHub. The repository includes source code and sample code for common use cases.
The examples in this topic use SMQ SDK for PHP V1.3.7. We recommend that you use the latest version of SMQ SDK for PHP for debugging. For version history, see Release notes.
Sample code
SMQ SDK for PHP includes sample code for queue and topic operations.
Queue operations
Queues support point-to-point messaging. The CreateQueueAndSendMessage.php demo covers the full lifecycle:
Create a queue
Send a message
Receive and consume a message
Delete a queue
For a step-by-step walkthrough, see Use queues.
Topic operations
Topics support publish-subscribe messaging. The CreateTopicAndPushMessageToQueue.php demo covers the full lifecycle:
Create a topic
Create a subscription whose downstream is a queue
Send a message
Subscribe to a topic to receive messages on downstream clients
Delete a topic
For a step-by-step walkthrough, see Use topics.
Related topics
Use queues: step-by-step guide with complete queue code examples.
Use topics: step-by-step guide with complete topic code examples.
Release notes: SDK version history and changelog.