All Products
Search
Document Center

Simple Log Service:Install the Log Service PHP SDK

Last Updated:Apr 10, 2026

To use the Log Service SDK for PHP, you must first install it. This topic describes the installation process.

Prerequisites

  • Log Service is activated. For more information, see Activate Log Service.

  • You have an access key. For more information, see access key.

    An Alibaba Cloud account's access key grants full permissions on all APIs, posing a high security risk. We recommend using a RAM user for API calls or routine O&M. You must grant the RAM user the required permissions to manage Log Service resources. For more information, see Create and authorize a RAM user.

  • A PHP development environment. For more information, visit the official website of PHP.

    The Log Service SDK for PHP supports PHP 5.2.1 and later. You can run the php -v command to check your installed PHP version.

Install the Log Service PHP SDK

  1. Download the latest Log Service SDK for PHP package.

  2. Unzip aliyun-log-php-sdk-master.zip.

  3. Copy the unzipped directory from step 2 to your project folder.

    The Log Service SDK for PHP requires no additional installation. In addition to the SDK code, the package contains third-party dependencies and an Autoloader class to simplify its use.

    You can now include the Log Service SDK in your project with require_once.

    require_once realpath(dirname(__FILE__) . '/../Log_Autoload.php');

Install with Composer

You can use Composer, a dependency management tool, to include the Log Service SDK in your project.

After installing Composer, use one of the following methods to add the Log Service SDK to your project. To learn how to install Composer, visit the official website of Composer.

  • Use the command line

    composer require  alibabacloud/aliyun-log-php-sdk
  • Add a dependency to the composer.json file

    {
        "require": {
            "alibabacloud/aliyun-log-php-sdk": "0.6.*"
        }
    }

References

Next steps

Get started with Log Service SDK for PHP