consilience/flysystem-azure-file-storage
Composer 安装命令:
composer require consilience/flysystem-azure-file-storage
包简介
Flysystem adapter for Windows Azure File Storage
README 文档
README
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.
consilience/flysystem-azure-file-storage 适用场景与选型建议
consilience/flysystem-azure-file-storage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 196.04k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2018 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 consilience/flysystem-azure-file-storage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 consilience/flysystem-azure-file-storage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 196.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 22
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-25