Download the PHP package xzhonour/laravel-aliyuncs-oss-storage without Composer

On this page you can find all versions of the php package xzhonour/laravel-aliyuncs-oss-storage. 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-aliyuncs-oss-storage

Laravel Aliyun OSS Filesystem Storage

说明

本项目Fork原项目地址 https://github.com/mitoop/laravel-alioss-storage 在原项目上以支持 laravel 9.x 不支持 laravel 9 以下版本,对9以下版本支持请访问原项目地址

Install

composer require xzhonour/laravel-aliyuncs-oss-storage

Require

Configure

config/filesystems.phpdisk里增加配置:

Use

可以使用 Laravel Storage 的所有方法

集成插件提供的方法 :

Notice

  1. deleteDir 删除文件夹方法. 方法直接返回为 false, 不会进行删除,如果要删除文件夹强烈推荐到阿里云后台操作.

  2. listContents 列出文件夹目录(支持递归)方法. 方法直接返回为空数组 [], 如果有此业务,可以考虑通过插件实现.

  3. 除了 has 方法, 所有方法在失败的时候都会返回 false (不抛出异常,但有日志记录),

    如果需要, 你可以用 === false 来判断是否成功. 配置正常的情况下, 失败概率极低.

  4. has 方法, 本身返回 true / false, 所以发生错误会抛出异常.

  5. $request->file('avatar')->store('avatars'); 上传文件直接 store 就生成随机名称,这里的 avatars 只是目录名称

    所以推荐使用 storeAs 方法来达到预期的目的.

    曾经遇到过 store 方法生成随机名称获取扩展的时候,对于 WPS 的 docx/pptx, 总是获取不到正确的文件扩展名称

    最后 storeAs 手动解决了.

  6. temporaryUrl 方法和 signUrl 是一样的效果, 区别仅在于第二个参数

    signUrl 传入的 int 类型, 例如, 传入30表示30秒后过期

    temporaryUrl 传入的是 \DateTimeInterface 类型, 例如, 传入 now()->addSeconds(30) 也是表示30秒后过期

support methods

普通写入

Storage::disk('aliOss')->write('test.txt','test');

写入流

Storage::disk('aliOss') ->writeStream('test1.txt',fopen('./app/Console/Commands/Test/TestCode.php','r'));

重命名文件

Storage::disk('aliOss')->rename('test.txt','test3.txt');

复制文件到目标

Storage::disk('aliOss')->copy('test.txt','temp/test.txt');

删除文件夹

创建文件夹

Storage::disk('aliOss')->createDirectory('temp1');

设置文件访问权限

Storage::disk('aliOss')->setVisibility('test3.txt',Visibility::PUBLIC);

文件是否存在

dd(Storage::disk('aliOss')->fileExists('test3.txt'));

读取文件

读取文件,流方式

dd(Storage::disk('aliOss')->readStream('test1.txt'));

列举文件列表

获取文件元信息

dd(Storage::disk('aliOss')->getMetaData('test3.txt'));

获取文件大小信息,获取不到时为 -1

dd(Storage::disk('aliOss')->getSize('test3.txt'));

获取文件mimetype

dd(Storage::disk('aliOss')->mimetype('test3.txt'));

获取文件lastModified

dd(Storage::disk('aliOss')->lastModified('test3.txt'));

获取文件访问权限

dd(Storage::disk('aliOss')->visibility('test3.txt'));\

移动文件

Storage::disk('aliOss')->move('test3.txt','temp1/test3.txt');

文件大小

dd(Storage::disk('aliOss')->fileSize('temp1/test3.txt'));

More

Storage方法通常会提供 options 参数. 最常用的就是设置文件可见性.

设置可见性:

Links

https://github.com/laravel/framework/tree/7.x/src/Illuminate/Filesystem

https://github.com/thephpleague/flysystem

https://help.aliyun.com/document_detail/32099.html

https://github.com/jacobcyl/Aliyun-oss-storage

https://github.com/thephpleague/flysystem-aws-s3-v3

https://github.com/apollopy/flysystem-aliyun-oss

License


All versions of laravel-aliyuncs-oss-storage with dependencies

PHP Build Version
Package Version
Requires aliyuncs/oss-sdk-php Version ^2.6.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 xzhonour/laravel-aliyuncs-oss-storage contains the following files

Loading the files please wait ....