This topic describes how to prepare the environment before you use the SDK for PHP to send and subscribe to messages.

Prerequisites

  • PHP 5.5.0 or later is installed. For more information, see Installation and Configuration.
    Important If the PHP version is earlier than 7.2.5, you must downgrade the version of the composer dependency to 2.2.x or earlier.
  • Composer is installed. For more information, see Install Composer.

After PHP is installed, you can run the php -v command to view the version of PHP.

Install the SDK for PHP

To install the SDK for PHP, perform the following steps:
  1. Add the following dependency to the composer.json file in your PHP installation directory:
    {
      "require": {
         "aliyunmq/mq-http-sdk": ">=1.0.4"
      }
    }
  2. Run the following command to use Composer to install the SDK for PHP:
    composer install