All Products
Search
Document Center

ApsaraMQ for RocketMQ:Prepare the environment for the PHP SDK

Last Updated:Mar 11, 2026

Set up the required dependencies before using the ApsaraMQ for RocketMQ 4.x SDK for PHP to send and subscribe to messages.

Prerequisites

Before you begin, make sure that you have:

Verify your PHP version:

php -v
Important

If your PHP version is earlier than 7.2.5, you must downgrade Composer to version 2.2.x or earlier. Later Composer versions are not compatible with PHP versions below 7.2.5.

Install the SDK

  1. Add the aliyunmq/mq-http-sdk dependency to the composer.json file in your PHP installation directory:

    {
         "require": {
           "aliyunmq/mq-http-sdk": ">=1.0.4"
         }
       }
  2. Install the dependency:

    composer install

    Composer downloads the SDK package to the vendor/ directory.

What's next

  • Send messages

  • Subscribe to messages