1. Go to this page and download the library: Download filacare/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/ */
filacare / flysystem-oss example snippets
use League\Flysystem\Filesystem;
use Filacare\Flysystem\Oss\OssAdapter;
$config = [
'accessKeyId' => 'yourAccessKeyId', // => false,
'securityToken' => null,
'bucket' => 'bucketName', // tionKey' => '' // Must be 32 characters or ''
];
$adapter = new OssAdapter($config);
$driver = new Filesystem($adapter);
// use dirver
$driver->writeStream(...);
// use adapter
$adapter->getUrl($path); // get web visit url
$adapter->bucket($bucket); // switch bucket in same endpoint
$adapter->cdnUrl($cdnUrl); // If you use cdn, don't forget to switch the cdn
// use client
$adapter->getClient()->uploadStream(...);