承接 cesurapp/storage-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

cesurapp/storage-bundle

最新稳定版本:1.2.0

Composer 安装命令:

composer require cesurapp/storage-bundle

包简介

Symfony storage bundle

README 文档

README

App Tester Software License

It is used for file storage. There is no database connection. Async-aws/s3 package is used for S3 connection. Tests are available for each driver, any test without access codes is skipped. You can use multiple drives at the same time. Use MediaBunle to keep track of files.

Supported Drivers

  • BackBlaze
  • CloudFlare
  • Local

Install

Required Symfony 8

composer req cesurapp/storage-bundle

Configuration

# config/packages/storage.yaml

storage:
  default: main
  devices:
    local:
      driver: local #backblaze, cloudflare, local
      root: "%kernel.project_dir%/storage/files"

    main:
      driver: s3
      root: /
      accessKey: "access_key"
      secretKey: "secret_key"
      bucket: "bucket_name"
      region: "auto"
      endPoint: "https://11d0547262baad2e6bdeb340e88f83be.r2.cloudflarestorage.com"

    backblaze:
      driver: backblaze
      root: /
      accessKey: "access_key"
      secretKey: "secret_key"
      bucket: "bucket_name"
      region: "auto"

Tests

Tests for which access codes are not defined are skipped.

<!--phpunit.xml.dist-->

<!--BackBlaze Test Keys-->
<server name="BACKBLAZE_ACCESS_KEY" value="KEY"/>
<server name="BACKBLAZE_SECRET" value="KEY"/>
<server name="BACKBLAZE_BUCKET" value="KEY"/>

<!--CloudFlare Test Keys-->
<server name="CLOUDFLARE_R2_ACCESS_KEY" value="KEY"/>
<server name="CLOUDFLARE_R2_SECRET" value="KEY"/>
<server name="CLOUDFLARE_R2_ENDPOINT" value="KEY"/>
<server name="CLOUDFLARE_R2_BUCKET" value="unit-test"/>

Usage

public function controllerAction(\Cesurapp\StorageBundle\Storage\Storage $storage) {
    // Upload File
    $storage->upload('source_path', 'upload_path');
    
    // Write File
    $storage->write('upload_path', 'text_content', 'application/text');
    
    // Delete
    $storage->delete('file_path');
    
    // Check
    $storage->exists('file_path');
    
    // Read
    $storage->read('file_path')
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-02