2017 © Pedro Peláez
 

library flysystem-azure-file-storage

Flysystem adapter for Windows Azure File Storage

image

consilience/flysystem-azure-file-storage

Flysystem adapter for Windows Azure File Storage

  • Monday, April 9, 2018
  • by judgej
  • Repository
  • 1 Watchers
  • 1 Stars
  • 78 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 50 % Grown

The README.md

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

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., (*2)

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., (*3)

Installation

Install package, (*4)

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., (*5)

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:, (*6)

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., (*7)

The Versions

09/04 2018

dev-master

9999999-dev

Flysystem adapter for Windows Azure File Storage

  Sources   Download

MIT

The Requires

 

The Development Requires

by Frank de Jonge
by Ilya Rogojin
by Consilience Media Ltd

09/04 2018

0.1.2

0.1.2.0

Flysystem adapter for Windows Azure File Storage

  Sources   Download

MIT

The Requires

 

The Development Requires

by Frank de Jonge
by Ilya Rogojin
by Consilience Media Ltd

26/02 2018

0.1.1

0.1.1.0

Flysystem adapter for Windows Azure File Storage

  Sources   Download

MIT

The Requires

 

The Development Requires

by Frank de Jonge
by Ilya Rogojin
by Consilience Media Ltd

25/02 2018

0.1.0

0.1.0.0

Flysystem adapter for Windows Azure File Storage

  Sources   Download

MIT

The Requires

 

The Development Requires

by Frank de Jonge
by Ilya Rogojin
by Consilience Media Ltd