Installation Guide
There are three ways to install the Alibaba Cloud OSS PHP SDK. We recommend using Composer.
Requirements
- PHP: Version 5.3 or higher.
- cURL Extension: The PHP cURL extension must be installed and enabled.
Installing cURL on Ubuntu
sudo apt-get install php-curl
Method 1: Using Composer (Recommended)
If you use Composer to manage your project dependencies, run the following command in your project's root directory:
composer require aliyuncs/oss-sdk-php
Alternatively, add the following to your composer.json file:
"require": {
"aliyuncs/oss-sdk-php": "~2.0"
}
Then run composer install. After installation, include the autoloader in your PHP script:
require_once __DIR__ . '/vendor/autoload.php';
Method 2: Download PHAR File
Download the packaged .phar file from the releases page. Include it directly in your code:
require_once '/path/to/oss-sdk-php.phar';
Method 3: Download Source Code
If you prefer not to use Composer or a Phar, download the source code and include the provided autoload.php file:
require_once '/path/to/oss-sdk/autoload.php';