farit-slv/selectel-flysystem-bundle

为selectel的api设计的Bundle

安装: 122

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 0

分支: 2

类型:symfony-bundle

1.2.2 2021-04-20 13:11 UTC

This package is auto-updated.

Last update: 2024-09-05 19:16:44 UTC


README

此Bundle实现了Selectel适配器,用于flysystem。主要针对那些希望使用flysystem抽象来访问Selectel云存储的服务。

安装

该Bundle通过composer安装,遵循标准结构,因此它会在symfony >= 4.2上自动安装。

  1. 将存储库添加到项目的composer.json

    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/crtweb/selectel-flysystem-bundle"
        }
    ]
  2. 将Bundle包添加到项目中

    $ composer require creative/selectel-flysystem-bundle
  3. 将Bundle包添加到项目中

    # app/config/packages/creative_selectel.yaml
    creative_selectel:
        account_id: 123123
        client_id: 123123_prod
        client_password: prod_password
        container: prod_container
  4. 将selectel适配器添加到flysystem

    # app/config/packages/oneup_flysystem.yaml
    services:
        League\Flysystem\FilesystemInterface:
            alias: League\Flysystem\Filesystem
    
    oneup_flysystem:
        adapters:
            default_adapter:
                local:
                    directory: '%kernel.cache_dir%/flysystem'
            selectel.flysystem_adapter:
                custom:
                    service: creative_selectel.adapter.adapter
        filesystems:
            default_filesystem:
                adapter: selectel.flysystem_adapter
                alias: League\Flysystem\Filesystem

配置

可用的Bundle选项

  • account_id - Selectel账户标识符

  • client_id - Selectel用户ID,存储访问将代表该用户进行

  • client_password - 用户密码

  • container - 文件将存储的容器

在本地环境中使用

请勿在本地开发或运行测试时使用生产容器。您应输入测试容器的坐标,或者使用本地文件系统的flysystem适配器。

# app/config/packages/dev/creative_selectel.yaml для локальной разработки
# app/config/packages/test/creative_selectel.yaml для тестов
creative_selectel:
    account_id: 123123
    client_id: 123123_test
    client_password: test_password
    container: test_container

# app/config/packages/dev/oneup_flysystem.yaml для локальной разработки
# app/config/packages/test/oneup_flysystem.yaml для тестов
services:
    League\Flysystem\FilesystemInterface:
        alias: League\Flysystem\Filesystem

oneup_flysystem:
    adapters:
        default_adapter:
            local:
                directory: '%kernel.cache_dir%/flysystem'
    filesystems:
        default_filesystem:
            adapter: default_adapter
            alias: League\Flysystem\Filesystem