承接 sessel/thinkphp-oss-filesystem 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sessel/thinkphp-oss-filesystem

最新稳定版本:v2.0.1

Composer 安装命令:

composer require sessel/thinkphp-oss-filesystem

包简介

oss filesystem for thinkphp

README 文档

README

Thinkphp对象存储Filesystem扩展, 基于 topthink/think-filesystem

安装

# ThinkPHP 6.x
composer require sessel/thinkphp-oss-filesystem:^1.0

# ThinkPHP 8.x
composer require sessel/thinkphp-oss-filesystem:^2.0

配置

# config/filesystem.php
...
//阿里云OSS
'aliyun' => [
    'type' => 'aliyun',
    'region' => 'region',
    'bucket' => 'bucket',
    'access_key_id' => 'access_key_id',
    'access_key_secret' => 'access_key_secret',
    'security_token' => null,
    'endpoint' => 'endpoint',
    'use_ssl' => true,
    'prefix' => 'prefix',
    'url' => '',
    'cdn_url' => '',
    'ram_role_arn' => 'ram_role_arn',
    'error_handler' => null,
]
//火山云TOS
'vetos' => [
    'type' => 'vetos',
    'ak' => 'ak',
    'sk' => 'sk',
    'region' => 'region',
    'bucket' => 'bucket',
    'prefix' => 'prefix',
    'domain' => 'custom domain',
    'endpoint' => 'https://xxx/',
],
...

示例

use think\facade\Filesystem;
use GuzzleHttp\Psr7\Utils;

$disk = Filesystem::disk('aliyun');
// $gen = $disk->listContents('/');
// $files = [];
// foreach($gen as $file){
//     $files[] = $file;
// }
// halt($files);
// halt($disk->url('/php.png'));
// halt($disk->has('/php.png'));
// halt($disk->has('/php2.png'));
// halt($disk->copy('/php2.png', 'php3.png'));
// halt($disk->delete('/php3.png'));
// halt($disk->read('/test.txt'));
// halt($disk->createDirectory('test'));
// halt($disk->fileExists('php5.png'));
// halt($disk->write('test.txt', '222');
// $content = '';
// for ($i = 0; $i < 20000; $i++) {
//     $content .= uniqid();
// }
// $veTosAdapter = app('oss.volcengine', ['config' => config('filesystem.disks.oss')]);
// $veTosAdapter = $disk->getAdapter();
// halt($veTosAdapter->appendWrite('test_append2.txt', $content, new Config(['next_append_offset' => 260000])));
// halt($disk->visibility('test.txt'));
// halt($disk->fileSize('test_append.txt'));
// halt($disk->mimeType('test_append.txt'));
// halt($disk->lastModified('test_append.txt'));
// halt($disk->read('test_append.txt'));
// $readStream = $disk->readStream('test_append.txt');
// $writeStream = fopen(public_path('static') . 'test_append.txt', 'w+');
// Utils::copyToStream(Utils::streamFor($readStream), Utils::streamFor($writeStream));

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-14