1. Go to this page and download the library: Download larva/flysystem-tos 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/ */
larva / flysystem-tos example snippets
use Tos\TosClient;
$client = new TosClient([
'region' => 'cn-beijing',
'endpoint' => 'tos-cn-beijing.volces.com',
'ak' => 'your-access-key',
'sk' => 'your-secret-key',
]);
use Larva\Flysystem\Tos\TOSAdapter;
use Larva\Flysystem\Tos\PortableVisibilityConverter;
$adapter = new TOSAdapter(
client: $client,
bucket: 'your-bucket-name',
prefix: '', // 可选,存储路径前缀
visibility: new PortableVisibilityConverter(), // 可选,可见性转换器
mimeTypeDetector: null, // 可选,MIME 类型检测器
options: [] // 可选,额外选项
);