PHP code example of huang-yi / flysystem-aliyun-oss

1. Go to this page and download the library: Download huang-yi/flysystem-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 / flysystem-aliyun-oss example snippets




uangYi\AliyunOss\OssClient;
use HuangYi\FlysystemAliyunOss\AliyunOssAdapter;
use League\Flysystem\Filesystem;

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

$client = new OssClient($bucketName, $endpoint, $accessKeyId, $accessKeySecret);
$adapter = new AliyunOssAdapter($client);
$filesystem = new Filesystem($adapter);