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

On this page you can find all versions of the php package larva/laravel-flysystem-kodo. 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-kodo

Laravel Flysystem Kodo

Stable Version Total Downloads License

适用于 Laravel 的七牛 Kodo(对象存储)Flysystem 适配器,完整支持七牛 Kodo 所有方法和操作。

要求

安装

该包支持 Laravel 包自动发现(Package Auto-Discovery),无需手动注册服务提供者。

配置

config/filesystems.phpdisks 中添加 Kodo 磁盘配置:

.env 文件中配置对应的环境变量:

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

使用

基本文件操作

文件上传

获取文件 URL

URL 生成遵循以下优先级:

  1. 若配置了 url(CDN/自定义域名),使用该地址拼接
  2. 否则根据文件可见性判断:
    • public:使用 {scheme}://{domain}/{path} 格式
    • private:生成 5 分钟有效期的临时下载 URL

临时 URL

获取 Kodo 客户端

如需直接调用七牛 SDK 的完整功能,可获取底层 Auth 实例:

前端直传:使用上传凭证上传

在 Web 应用中,通常需要让浏览器直接上传文件到七牛 Kodo,而不经过服务器中转。通过后端生成上传凭证,前端使用七牛 JavaScript SDK 或 axios 即可实现直传。

这种方式的优势是 AccessKey 不会暴露给前端,且文件无需经过应用服务器。

后端:生成上传凭证

定义一个 API 路由,返回上传凭证:

前端:使用 axios 上传

七牛 Kodo 使用表单上传方式,需要通过 FormData 提交文件:

前端:使用七牛 JavaScript SDK 上传

也可以通过七牛官方 JavaScript SDK 进行上传:

安全提示:前端直传方式使用的是后端生成的临时上传凭证,AccessKey 不会暴露给前端。上传凭证可以设置过期时间和上传策略限制(如文件大小、MIME 类型等)。

关于 url 配置

url 应使用七牛存储空间绑定的域名(CDN 或自定义域名),如 https://cdn.example.com

如果使用自定义域名作为 endpoint,可设置 is_custom_domaintrue,此时将自动从 endpoint 生成 url

开发

代码风格检查

本项目使用 PHP-CS-Fixer 统一代码风格。

相关文档

License

MIT


All versions of laravel-flysystem-kodo 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-kodo 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-kodo contains the following files

Loading the files please wait ...