百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

aliyun-oss-laravel

> 后端框架
开源

Alibaba Cloud Object Storage Service For Laravel。阿里云对象存储服务扩展包,支持最新版的Laravel。

182 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Alibaba Cloud Object Storage Service For Laravel。阿里云对象存储服务扩展包,支持最新版的Laravel。

English | 简体中文

Aliyun OSS Laravel

This package is a wrapper bridging aliyun-oss-flysystem into Laravel as an available storage disk.
If client direct transmission is required, Use web server signature direct transmission OSS extension package aliyun-oss-appserver.

Compatibility

laravel aliyun-oss-laravel driver readme
>=5.5,=9.0 ^4.0 oss readme

Installation

  1. If you use the composer to manage project dependencies, run the following command in your project's root directory:
    bash
    composer require alphasnow/aliyun-oss-laravel
    Then run composer install to install the dependency.
  2. Modify the environment file .env
    env
    OSS_ACCESS_KEY_ID=
    OSS_ACCESS_KEY_SECRET=
    OSS_BUCKET=
    OSS_ENDPOINT=
  3. (Optional) Modify the configuration file config/filesystems.php
…

Usage

php
use Illuminate\Support\Facades\Storage;
$storage = Storage::disk("oss");

Use storage method

Write

…

Read

php
Storage::disk("oss")->url("dir/path/file.txt");
Storage::disk("oss")->temporaryUrl("dir/path/file.txt", \Carbon\Carbon::now()->addMinutes(30));

Storage::disk("oss")->get("dir/path/file.txt"); 

Storage::disk("oss")->exists("dir/path/file.txt"); 
Storage::disk("oss")->size("dir/path/file.txt"); 
Storage::disk("oss")->lastModified("dir/path/file.txt");

Delete

php
Storage::disk("oss")->delete("dir/path/file.txt");
Storage::disk("oss")->delete(["dir/path/file1.txt", "dir/path/file2.txt"]);

File operation

php
Storage::disk("oss")->copy("dir/path/file.txt", "dir/path/file_new.txt");
Storage::disk("oss")->move("dir/path/file.txt", "dir/path/file_new.txt");
Storage::disk("oss")->rename("dir/path/file.txt", "dir/path/file_new.txt");

Folder operation

php
Storage::disk("oss")->makeDirectory("dir/path"); 
Storage::disk("oss")->deleteDirectory("dir/path");

Storage::disk("oss")->files("dir/path");
Storage::disk("oss")->allFiles("dir/path");

Storage::disk("oss")->directories("dir/path"); 
Storage::disk("oss")->allDirectories("dir/path"); 

Use macro

default macro

…

Add custom macro

  1. Add Macro
    php
    namespace App\Macros;
    use AlphaSnow\LaravelFilesystem\Aliyun\Macros\AliyunMacro;
    
    class ListBuckets implements AliyunMacro
    {
        // ... 
    }
    Reference code: AppendObject.php
  2. Modify the config
    php
    [
        "macros" => [\App\Macros\ListBuckets::class]
    ]
  3. Use Macro
    php
    Storage::disk("oss")->listBuckets()

Use OssClient

php
use AlphaSnow\LaravelFilesystem\Aliyun\OssClientAdapter;

$adapter = new OssClientAdapter(Storage::disk("oss"));
$adapter->client()->appendObject($adapter->bucket(), $adapter->path("dir/path/file.txt"), "contents", 0, $adapter->options(["visibility" => "private"]));

Documentation

AlibabaCloud Object Storage Service Documentation

Issues

Opening an Issue

Contributors

Star History

License

MIT

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPaliyunfilesystemflysystem-adapterlaravel

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架