定制 glueful/storage-azure 二次开发

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

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

glueful/storage-azure

最新稳定版本:v1.0.0

Composer 安装命令:

composer require glueful/storage-azure

包简介

Azure Blob Storage driver for the Glueful framework.

README 文档

README

Azure Blob Storage driver for Glueful.

Install

composer require glueful/storage-azure
php glueful extensions:enable storage-azure

The package auto-registers as a Glueful extension through extra.glueful.provider. After install, any disk with driver => azure is resolved by AzureStorageDriverFactory.

Configuration

Add a disk under config/storage.php:

'azure' => [
    'driver' => 'azure',
    'container' => env('AZURE_STORAGE_CONTAINER'),
    'connection_string' => env('AZURE_STORAGE_CONNECTION_STRING'),
    'prefix' => env('AZURE_STORAGE_PREFIX', ''),
    'signed_ttl' => (int) env('AZURE_SIGNED_URL_TTL', 3600),
],

Environment variables:

AZURE_STORAGE_CONTAINER=media
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=...
AZURE_STORAGE_PREFIX=
AZURE_SIGNED_URL_TTL=3600

connection_string is used for filesystem construction and native SAS URL generation. The connection string must include credentials that can sign SAS URLs.

Upgrading from framework 1.53 Azure storage

Framework 1.54 moves Azure storage into this provider pack and this package uses azure-oss/storage-blob-flysystem instead of the older league/flysystem-azure-blob-storage plus Microsoft SDK stack. Existing container, connection_string, prefix, and signed_ttl disk config values carry over unchanged.

If an application already builds its own Flysystem adapter, it may still pass a prebuilt adapter instance in the disk config. The provider pack wraps that adapter directly and does not require a connection string for that escape hatch.

Native URLs

The framework always supports app-signed blob URLs through /blobs/{uuid}. Direct provider URLs are opt-in and visibility-scoped:

// config/uploads.php
'native_urls' => [
    'disks' => [
        'azure' => [
            'enabled' => true,
            'public' => true,
            'private' => false,
            'private_ttl' => 300,
        ],
    ],
    'max_private_ttl' => 900,
],

Private native URLs are bearer tokens from Azure Blob Storage. Keep them short-lived and prefer the app-signed URL when application-side authorization or revocation matters.

Diagnostics

Run a read-only check:

php glueful storage:test azure

Run a write/read/delete smoke test only when you want to verify write permissions:

php glueful storage:test azure --write

Development

composer test
composer run analyze
composer run phpcs

统计信息

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

GitHub 信息

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

其他信息

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