baywa-re-lusy/file-storage 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

baywa-re-lusy/file-storage

最新稳定版本:6.0.1

Composer 安装命令:

composer require baywa-re-lusy/file-storage

包简介

BayWa r.e. LUSY File Storage Tools

README 文档

README

CircleCI

Installation

To install the File Storage tools, you will need Composer in your project:

composer require baywa-re-lusy/file-storage

Azure Blob Storage

A configured Azure Blob Storage is needed to use the AzureBlobAdapter. It can be created using terraform:

# Create the Storage Account
resource "azurerm_storage_account" "blob_storage" {
  name                     = "storage-name"
  resource_group_name      = "resourge-group-name"
  location                 = "location"
  account_tier             = "Standard"
  account_replication_type = "GRS"
}

# Create a Blob Share inside the Storage Account
resource "azurerm_storage_container" "container" {
  name                  = "content"
  storage_account_name  = azurerm_storage_account.blob_storage.name
  container_access_type = "private"
}

# Generate Shared Access Signature
# the property "signed_version" can't be set (or must be an old one) and "tag" and "filter" must be set to false
# see https://github.com/hashicorp/terraform-provider-azurerm/issues/17558
data "azurerm_storage_account_sas" "sas" {
  connection_string = azurerm_storage_account.file_storage.primary_connection_string
  https_only        = true

  resource_types {
    service   = true
    container = true
    object    = true
  }

  services {
    blob  = true
    queue = false
    table = false
    file  = false
  }

  start  = "2022-05-17T00:00:00Z"
  expiry = "2024-05-17T00:00:00Z"

  permissions {
    read    = true
    write   = true
    delete  = true
    list    = true
    add     = false
    create  = true
    update  = false
    process = false
    tag     = false
    filter  = false
  }
}

output "azure_shared_access_signature" {
  value = data.azurerm_storage_account_sas.sas.sas
  sensitive = true
}

Once the infrastructure is updated, retrieve the SAS Connection string with:

terraform output azure_shared_access_signature

Usage

Currently, this library supports Azure Blob Storage. However, it uses an Adapter pattern to allow adding other vendors easily.

Azure Blob

use BayWaReLusy\FileStorage\FileStorageService;
use BayWaReLusy\FileStorage\Adapter\AzureBlobAdapter;

$adapter            = new AzureBlobAdapter('<storage-account-name>', '<container name>', '<shared-access-signature>');
$fileStorageService = new FileStorageService($adapter);

Local Storage

This library also includes a Local adapter for testing purposes.

You have to supply the adapter with the path to the remote directory (it has to contain the 'public' folder) created beforehand and given the appropriate rights for writing as well as the API's URL.

use BayWaReLusy\FileStorage\FileStorageService;
use BayWaReLusy\FileStorage\Adapter\LocalAdapter;

$adapter            = new LocalAdapter('/var/www/html/public/remote', 'https://my-api.api-url.com');
$fileStorageService = new FileStorageService($adapter);

统计信息

  • 总下载量: 279
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2022-05-31