Download the PHP package larva/laravel-flysystem-oss without Composer

On this page you can find all versions of the php package larva/laravel-flysystem-oss. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-flysystem-oss

Laravel Flysystem OSS

Stable Version Total Downloads License

适用于 Laravel 的阿里云 OSS(Object Storage Service)Flysystem 适配器,完整支持 Flysystem v3 的所有文件操作接口,并提供临时 URL 签名、自定义访问域名等扩展能力。

环境要求

依赖 版本
PHP ^8.2
Laravel Framework ^12.0 || ^13.0
League Flysystem ^3.0
larva/flysystem-oss ^1.0

安装

该包通过 Laravel 的包发现机制自动注册服务提供者 Larva\Flysystem\Aliyun\ObjectStorageServiceProvider,无需手动注册。

配置

修改配置文件 config/filesystems.php,在 disks 中添加一个 oss 磁盘配置:

如需将其设为默认存储驱动,修改 default 配置:

环境变量示例

.env 文件中添加对应的环境变量:

使用

本包完全兼容 Laravel 文件系统 API,使用方式与本地存储一致,参见 Laravel Filesystem 文档

基础文件操作

目录操作

文件元信息

可见性(ACL)管理

可见性映射关系:

Flysystem 可见性 OSS ACL
public public-read
private private

获取文件 URL

url 配置项被设置时,所有生成的 URL 均以该自定义域名为前缀:

url 未设置时:

临时签名 URL

可为任意文件生成指定有效期的临时访问 URL,适用于私有文件的临时授权访问:

Web 直传(预签名上传)

通过预签名上传 URL,前端可直接将文件上传到 OSS,无需经过后端服务器中转,适用于大文件上传或前端直传场景。

后端:生成预签名上传 URL

也可以在生成签名时指定请求头(如 Content-Type、自定义元信息等),前端上传时必须携带完全相同的请求头:

前端:使用预签名 URL 上传

以下是使用 axios 进行 PUT 上传的示例:

注意:如果生成预签名 URL 时传入了 Content-Type 等请求头,前端上传时必须携带完全一致的值,否则 OSS 会返回签名不匹配错误。

获取 OSS 客户端

如需调用阿里云 OSS SDK 的高级功能,可直接获取底层的 OssClient 实例:

上传时的扩展选项

通过 visibility 配置或上传参数,可在写入时指定 OSS 特有的选项(如服务端加密、存储类型、标签等):

支持的 OSS 特有选项:

选项 说明
Cache-Control HTTP 缓存控制头
Content-Disposition 内容处置头
Content-Encoding 内容编码
Content-MD5 内容 MD5 校验值
Content-Length 内容长度
x-oss-forbid-overwrite 是否禁止覆盖同名对象
x-oss-server-side-encryption 服务端加密方式
x-oss-server-side-data-encryption 服务端数据加密方式
x-oss-server-side-encryption-key-id KMS 加密密钥 ID
x-oss-object-acl 对象 ACL
x-oss-storage-class 存储类型(Standard / IA / Archive 等)
x-oss-tagging 对象标签

贡献

欢迎提交 Issue 和 Pull Request。提交代码前请确保通过代码风格检查:

License

MIT License (c) Larva Tech


All versions of laravel-flysystem-oss with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.0|^13.0
league/flysystem Version ^3.0
larva/flysystem-oss Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package larva/laravel-flysystem-oss contains the following files

Loading the files please wait ...