PHP code example of huang-yi / aliyun-oss

1. Go to this page and download the library: Download huang-yi/aliyun-oss library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

huang-yi / aliyun-oss example snippets




uangYi\AliyunOss\OssClient;

$bucketName = 'bucket';
$endpoint = 'oss-cn-hangzhou.aliyuncs.com';
$accessKeyId = 'access_key_id';
$accessKeySecret = 'access_key_secret';

$client = new OssClient($bucketName, $endpoint, $accessKeyId, $accessKeySecret);

// Service APIs
$client->service->getService();

// Bucket APIs
$client->bucket->getBucket();

// Object APIs
$client->object->putObject('new-object', 'contents');