PHP code example of monster / flysystem-aliyun-oss

1. Go to this page and download the library: Download monster/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/ */

    

monster / flysystem-aliyun-oss example snippets




use League\Flysystem\Filesystem;
use League\Flysystem\AliyunOSS\AliyunOSSAdapter;

$OSSClient = new \ALIOSS($accessKey, $accessSecret, $endPoint);

$adapter = new AliyunOSSAdapter($OSSClient, 'files-bucket');
$flysystem = new Filesystem($adapter);

$flysystem->write('test.txt', 'this is test file content.');