定制 azure-oss/storage-blob-symfony 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

azure-oss/storage-blob-symfony

Composer 安装命令:

composer require azure-oss/storage-blob-symfony

包简介

Symfony bundle bridge for the Azure-OSS Flysystem adapter (league/flysystem-bundle 3.7+).

README 文档

README

Latest Version on Packagist Packagist Downloads

Community-driven PHP SDKs for Azure, because Microsoft won't.

In November 2023, Microsoft officially archived their Azure SDK for PHP and stopped maintaining PHP integrations for most Azure services. No migration path, no replacement — just a repository marked read-only.

We picked up where they left off.

Screenshot

This package is the Symfony bridge for azure-oss/storage-blob-flysystem. It registers a azure_oss adapter shortcut with league/flysystem-bundle so storages can be declared directly in config/packages/flysystem.yaml.

Our other packages:

Requirements

  • PHP 8.2+
  • league/flysystem-bundle 3.7 or newer (the version that introduced the pluggable AdapterDefinitionBuilderInterface).

Install

composer require azure-oss/storage-blob-symfony

If you have Symfony Flex installed it will register AzureOss\Storage\BlobFlysystemSymfony\AzureStorageBlobFlysystemBundle for you. Otherwise add it to config/bundles.php:

return [
    // ...
    AzureOss\Storage\BlobSymfony\AzureStorageBlobFlysystemBundle::class => ['all' => true],
];

Quickstart

Declare a BlobServiceClient service and reference it from a flysystem storage that uses the azure_oss adapter:

# config/services.yaml
services:
    azure_blob_service_client:
        class: AzureOss\Storage\Blob\BlobServiceClient
        factory: ['AzureOss\Storage\Blob\BlobServiceClient', 'fromConnectionString']
        arguments:
            - '%env(AZURE_STORAGE_CONNECTION_STRING)%'
# config/packages/flysystem.yaml
flysystem:
    storages:
        default.storage:
            azure_oss:
                client: azure_blob_service_client
                container: '%env(AZURE_STORAGE_CONTAINER)%'
                # Optional:
                # prefix: 'optional/path/prefix'
                # mime_type_detector: 'my.custom.mime_type_detector'
                # visibility_handling: throw  # or 'ignore'
                # public_container: false
            visibility: public

You can now autowire the storage anywhere:

use League\Flysystem\FilesystemOperator;

final class MyService
{
    public function __construct(
        private readonly FilesystemOperator $defaultStorage,
    ) {
    }
}

Configuration reference

Option Required Default Description
client yes Service id of a configured AzureOss\Storage\Blob\BlobServiceClient. You choose the auth — connection string, SAS token, Entra ID / managed identity.
container yes Azure Blob Storage container name.
prefix no '' Path prefix prepended to every blob name.
mime_type_detector no null Service id of a League\MimeTypeDetection\MimeTypeDetector. Defaults to the adapter's FinfoMimeTypeDetector.
visibility_handling no throw What to do when setVisibility() is called (Azure has no per-blob ACL). throw or ignore.
public_container no false Whether the underlying container is set to public access. Affects URL generation.

Authentication

Authentication is delegated to whatever BlobServiceClient you supply via client. Besides connection strings the SDK supports SAS tokens and token-based credentials (Entra ID, managed identity, workload identity). See the azure-oss/storage documentation for the full set of authentication helpers.

License

This project is released under the MIT License. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固