You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
PHP
Install PHP SDK
Copy page
Download PDF
Install PHP SDK
This article explains how to install the TOS PHP SDK.​
Environment​
  • The TOS PHP SDK supports PHP version 5.6 and above; this document uses PHP 5.6 as an example.​
tip​
Since TOS provides an HTTP protocol interface, your PHP environment needs to enable the cURL and OpenSSL extensions through php.ini to send HTTP or HTTPS requests.​
  • Supported operating systems: Linux, macOS, and Windows.​
Source code download​
  • For the TOS PHP SDK source code, see: GitHub.​
Installation methods​
You can install the SDK using the following methods:​
(Recommended) Use PHP's package manager composer​
warning​
composer version V1 stopped supporting on September 1, 2025; please use composer version V2.​
  1. Run the following command to upgrade Composer from V1.x to V2.x.​
  • ​
    // Download the specified version of Composer 2​
    curl -sS https://getcomposer.org/installer | php -- --version=2.7.6​
    // Install to the global PATH​
    sudo mv composer.phar /usr/bin/composer​
    // Verify​
    composer --version​
    ​
  1. Directly run composer require volcengine/ve-tos-php-sdk, or add the following dependency in composer.json and then run composer install.​
  • ​
    {​
    "require": {​
    "volcengine/ve-tos-php-sdk": "^2.1"​
    }​
    }​
    ​
  1. After successful installation, TOS PHP SDK will be included in the vendor/ directory; you can import dependencies in your code as follows.​
  • ​
    // Assume the script integrating the SDK and the vendor/ directory are under the same parent directory​
    require_once __DIR__ . '/vendor/autoload.php';​
    ​
Use the phar file of TOS PHP SDK​
  1. Select the corresponding version on GitHub and directly download the packaged phar file.​
  1. Import dependencies in your code as follows.​
  • ​
    // Assume the script integrating the SDK and the TOS PHP SDK source code are under the same parent directory when using source installation​
    require_once __DIR__ . '/ve-tos-php-sdk-2.x.x.phar';​
    ​
Use TOS PHP SDK source code​
  1. Select the corresponding version on GitHub and download the source code directly.​
  1. After downloading, the TOS PHP SDK source code includes the autoload.php file, which can be used to include dependencies in the code as follows.​
  • ​
    // Assume the script integrating the SDK and the TOS PHP SDK source code are under the same parent directory when using source installation​
    require_once __DIR__ . '/autoload.php';​
    ​
​
Last updated: 2026.01.14 17:13:15