koffinate/laravel-filesystem
最新稳定版本:v1.0.3
Composer 安装命令:
composer require koffinate/laravel-filesystem
包简介
Illuminate filesystem compatibility with Minio Support
关键字:
README 文档
README
Installation
composer require koffinate/laravel-filesystem
Configuration
add this to your environment
MINIO_ACCESS_KEY_ID="minio-access-key" MINIO_SECRET_ACCESS_KEY="minio-secret-access-key" MINIO_DEFAULT_REGION="minio-region" MINIO_BUCKET="minio-bucket" MINIO_USE_PATH_STYLE_ENDPOINT=true MINIO_URL="minio-full-url-with-bucket-include" MINIO_ENDPOINT="minio-endpoint-without-bucket-included" MINIO_VISIBILITY="public"
or use default laravel aws-s3 environment,
AWS_ACCESS_KEY_ID="s3-access-key" AWS_SECRET_ACCESS_KEY="s3-secret-access-key" AWS_DEFAULT_REGION="s3-region" AWS_BUCKET="s3-bucket" AWS_USE_PATH_STYLE_ENDPOINT=false AWS_URL="s3-full-url-with-bucket-include" AWS_ENDPOINT="s3-endpoint-without-bucket-included" AWS_VISIBILITY="public"
actually if you want to use both of minio and s3 together, use AWS_ and MINIO_ on your .env.
Custom configuration
You can still customize the configuration by defining new disks with minio key to config/filesystem.php.
or use this command to generate from default config
php artisan koffinate:minio-config
Usage
use normally laravel filesystem as you go.
make sure your FILESYSTEM_DISK on .env set to minio as default,
... FILESYSTEM_DISK=minio ...
or MEDIA_DISK if using spatie/laravel-medialibrary's package.
... MEDIA_DISK=minio ...
Obtain disk usage
you can use it directly using method disk from Storage,
// put content into file Storage::disk('minio')->put('file.jpg', $contents); // read file contents $contents = Storage::disk('minio')->get('file.jpg'); // check file is exists if (Storage::disk('minio')->exists('file.jpg')) { // ... } // check file is missing or not exists if (Storage::disk('minio')->missing('file.jpg')) { // ... }
on file upload,
// store on folder $request->file('files')->store('path-to-folder', 'minio'); // store on folder with new name $request->file('files')->storeAs('path-to-folder', 'file.jpg', 'minio');
read more usage on Laravel Filesystem.
统计信息
- 总下载量: 3.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-17