PHP code example of lovexjho / flysystem-tos-oss

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

    

lovexjho / flysystem-tos-oss example snippets


'tos' => [
            'driver' => TosAdapterFactory::class,
            'region' => env('TOS_REGION'),
            'bucket' => env('TOS_BUCKET'),
            'endpoint' => env('TOS_ENDPOINT'),
            'ak' => env('AK'),
            'sk' => env('SK'),
            'securityToken' => env('SECURITY_TOKEN'),
            'connectionTimeout' => 10000, // 毫秒
            'socketTimeout' => 30000, // 毫秒,
            'enableVerifySSL' => true
        ]

$filesystemFactory = make(\Hyperf\Filesystem\FilesystemFactory::class);
$tos = $filesystemFactory->getAdapter('tos');

$preSign = $tos->preSignedURL($path, new \League\Flysystem\Config([
'httpMethod' => \Tos\Model\Enum::HttpMethodPut,
'expires' => 3600
]));

var_dump($preSign);