PHP code example of zing / flysystem-oss

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

    

zing / flysystem-oss example snippets


use League\Flysystem\Filesystem;
use OSS\OssClient;
use Zing\Flysystem\Oss\OssAdapter;

$prefix = '';
$config = [
    'provider' => new StaticCredentialsProvider('aW52YWxpZC1rZXk=', 'aW52YWxpZC1zZWNyZXQ='),
    'bucket' => 'test',
    'endpoint' => 'oss-cn-shanghai.aliyuncs.com',
];

$config['options'] = [
    'url' => '',
    'endpoint' => $config['endpoint'], 
    'bucket_endpoint' => '',
    'temporary_url' => '',
];

$client = new OssClient($config);
$adapter = new OssAdapter($client, $config['bucket'], $prefix, null, null, $config['options']);
$flysystem = new Filesystem($adapter);