consilience/flysystem-azure-file-storage 问题修复 & 功能扩展

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

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

consilience/flysystem-azure-file-storage

最新稳定版本:1.0.0

Composer 安装命令:

composer require consilience/flysystem-azure-file-storage

包简介

Flysystem adapter for Windows Azure File Storage

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Azure File Storage adapter for Flysystem

This repo is fork of League\Flysystem\Azure with the underlying Azure API library changed from microsoft/azure-storage to microsoft/azure-storage-file. The original driver supports Azure blob storage, with a flat binary object structure. This driver supports Azure file storage, which includes directory capabilities.

A separate service provider package for Laravel 5.5+ is available here: https://github.com/academe/laravel-azure-file-storage-driver The service provider allows Azure File Storage shares tbe be used as a native filesystem within Laravel.

Installation

Install package

composer require consilience/flysystem-azure-file-storage

How to use this driver

Note: if you are using Laravel then the filesystem driver will wrap and abstract all of this for you.

use League\Flysystem\Filesystem;
use Consilience\Flysystem\Azure\AzureFileAdapter;
use MicrosoftAzure\Storage\File\FileRestProxy;
use Illuminate\Support\ServiceProvider;

// A helper method for constructing the connectionString may be usedful,
// if there is a demand.

$connectionString = sprintf(
    'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s',
    '{storage account name}',
    '{file storage key}'
);

$config = [
    'endpoint' => $connectionString,
    'container' => '{file share name}',
    // Optional to prevent directory deletion recursively deleting
    // all descendant files and direcories.
    //'disableRecursiveDelete' => true,
    // Optional driver options can also be added here. e.g. CacheControl, Metadata.
];

$fileService = FileRestProxy::createFileService(
    $connectionString,
    [] // $optionsWithMiddlewares
);

$filesystem = new Filesystem(new AzureFileAdapter(
    $fileService,
    $config,
    'optional-directory-prefix'
));

// Now the $filesystem object can be used as a standard
// Flysystem file system.
// See https://flysystem.thephpleague.com/api/

// A few examples:

$content    = $filesystem->read('path/to/my/file.txt');
$resource   = $filesystem->readResource('path/to/my/file.txt');
$success    = $filesystem->createDir('new/directory/here');
$success    = $filesystem->rename('path/to/my/file.txt', 'some/other/folder/another.txt');

// The URL of a file can be found like this:

$url = $filesystem->getAdapter()->getUrl('path/to/my/foo.bar');

Testing

Set up .env and run live tests:

composer install
vendor/bin/phpunit --testsuite flysystem-azure-live-tests

These will create/delete a few test files and directories in the root of the Azure file share.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-25