live-controls/storage

该软件包最新版本(v1.2.6)没有可用的许可证信息。

live-controls的对象存储库

v1.2.6 2024-08-19 00:02 UTC

This package is auto-updated.

Last update: 2024-09-19 00:14:00 UTC


README

Release Version Packagist Version

live-controls的对象存储库

要求

  • PHP 8.0+
  • S3兼容对象存储托管服务,如Contabo或DigitalOcean

翻译

安装

composer require live-controls/storage

设置FluentObjectStorageHandler

  1. 如果您想使用DBDisks,创建迁移如下
php artisan vendor:publish --provider="LiveControls\Storage\StorageServiceProvider" --tag="migrations"

设置ObjectStorageHandler

  1. 添加到.env文件中
OBJECTSTORAGE_ACCESS_KEY_ID=53234123 //Should be the access key id to the storage
OBJECTSTORAGE_SECRET_ACCESS_KEY=0000000 //Should be the secret access key to the storage
OBJECTSTORAGE_DEFAULT_REGION=usc1 //Should match the subdomain in endpoint or url
OBJECTSTORAGE_BUCKET=bucketName //The name of the bucket
OBJECTSTORAGE_URL=https://usc1.contabostorage.com/1234567890:bucketName //The url of the bucket
OBJECTSTORAGE_ENDPOINT=https://usc1.contabostorage.com/ //The endpoint of the bucket
OBJECTSTORAGE_USE_PATH_STYLE_ENDPOINT=true //Needs to be true to work!
  1. 添加到config/filesystems.php文件中
'disks' => [
     ...
   'objectstorage' => [
       'driver' => 's3',
       'key' => env('OBJECTSTORAGE_ACCESS_KEY_ID'),
       'secret' => env('OBJECTSTORAGE_SECRET_ACCESS_KEY'),
       'region' => env('OBJECTSTORAGE_DEFAULT_REGION'),
       'bucket' => env('OBJECTSTORAGE_BUCKET'),
       'url' => env('OBJECTSTORAGE_URL'),
       'endpoint' => env('OBJECTSTORAGE_ENDPOINT'),
       'use_path_style_endpoint' => env('OBJECTSTORAGE_USE_PATH_STYLE_ENDPOINT', false),
       'throw' => false,
   ],
]
  1. 使用以下命令发布配置文件
php artisan vendor:publish --tag="livecontrols.storage.config"
  1. 将"storage:disk"设置为步骤2中设置的磁盘名称

用法

待办事项