PHPackages                             starfalling/aliyun-oss-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. starfalling/aliyun-oss-php-sdk

ActiveLibrary

starfalling/aliyun-oss-php-sdk
==============================

Aliyun OSS SDK for PHP (fork for swoole)

2.3.1.5(5y ago)267.1k↓50%2MITPHPPHP &gt;=5.3

Since Nov 28Pushed 5y agoCompare

[ Source](https://github.com/starfalling/aliyun-oss-php-sdk)[ Packagist](https://packagist.org/packages/starfalling/aliyun-oss-php-sdk)[ Docs](http://www.aliyun.com/product/oss/)[ RSS](/packages/starfalling-aliyun-oss-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (41)Used By (0)

Alibaba Cloud OSS SDK for PHP
=============================

[](#alibaba-cloud-oss-sdk-for-php)

(阿里云 OSS SDK Swoole 协程兼容版)

**需要打开 Swoole 的 CURL HOOK，并安装 4.4.15 版本以上的 Swoole**

[README of Chinese](https://github.com/aliyun/aliyun-oss-php-sdk/blob/master/README-CN.md)
------------------------------------------------------------------------------------------

[](#readme-of-chinese)

Overview
--------

[](#overview)

Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Cloud, featuring a massive capacity, security, a low cost, and high reliability. You can upload and download data on any application anytime and anywhere by calling APIs, and perform simple management of data through the web console. The OSS can store any type of files and therefore applies to various websites, development enterprises and developers.

Run environment
---------------

[](#run-environment)

- PHP 5.3+.
- cURL extension.

Tips:

- In Ubuntu, you can use the ***apt-get*** package manager to install the *PHP cURL extension*: `sudo apt-get install php5-curl`.

Install OSS PHP SDK
-------------------

[](#install-oss-php-sdk)

- If you use the ***composer*** to manage project dependencies, run the following command in your project's root directory:

    ```
      composer require aliyuncs/oss-sdk-php

    ```

    You can also declare the dependency on Alibaba Cloud OSS SDK for PHP in the `composer.json` file.

    ```
      "require": {
          "aliyuncs/oss-sdk-php": "~2.0"
      }

    ```

    Then run `composer install` to install the dependency. After the Composer Dependency Manager is installed, import the dependency in your PHP code:

    ```
      require_once __DIR__ . '/vendor/autoload.php';

    ```
- You can also directly download the packaged [PHAR File](https://github.com/aliyun/aliyun-oss-php-sdk/releases), and introduce the file to your code:

    ```
      require_once '/path/to/oss-sdk-php.phar';

    ```
- Download the SDK source code, and introduce the `autoload.php` file under the SDK directory to your code:

    ```
      require_once '/path/to/oss-sdk/autoload.php';

    ```

Quick use
---------

[](#quick-use)

### Common classes

[](#common-classes)

ClassExplanationOSS\\OSSClientOSS client class. An OSSClient instance can be used to call the interface.OSS\\Core\\OSSExceptionOSS Exception class . You only need to pay attention to this exception when you use the OSSClient.### Initialize an OSSClient

[](#initialize-an-ossclient)

The SDK's operations for the OSS are performed through the OSSClient class. The code below creates an OSSClient object:

```
