Skip to content

Commit

Permalink
More readme details.
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed Feb 25, 2018
1 parent 485942e commit ab99a66
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: php

php:
- 7.0
- 7.1

env:
global:
- secure:

before_install:
- travis_retry composer self-update

install:
- travis_retry composer install --no-interaction --prefer-dist

script:
- php vendor/bin/phpunit
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
# Azure File Storage Filesystem Driver for Laravel 5

Still under development, but fundtional.
[![GitHub issues](https://img.shields.io/github/issues/academe/laravel-azure-file-storage-driver.svg)](https://github.com/academe/laravel-azure-file-storage-driver/issues)
[![GitHub license](https://img.shields.io/github/license/academe/laravel-azure-file-storage-driver.svg)](https://github.com/academe/laravel-azure-file-storage-driver/blob/master/LICENCE)

# Microsoft Azure File Storage Filesystem Driver for Laravel 5

This package allows Microsoft Azure File Storage
to be used as a filesystem in laravel 5.

## Installation

TODO: Laravel 5.5+ and earlier versions.
academe/laravel-azure-file-storage-driver

## Usage

If you're on Laravel 5.4 or earlier, add the service provider in your `config/app.php`:

'providers' => [
...
Academe\Laravel\AzureFileStorageDriver\ServiceProvider::class,
...
],

For Laravel 5.5+ this step is not necessary.

## Configuration in `config/filesystems.php`:
## Configuration

Add the following to `config/filesystems.php`:

```php
[
Expand Down Expand Up @@ -35,6 +54,12 @@ TODO: Laravel 5.5+ and earlier versions.
];
```

If you want to use multiple Azure file storage shares, then create additional
entries in the `disks` array with the appropriate settings for each share.

An example list of environment variable entries can be found in `.env.example`.
You can add that to your `.env` file and add your credentials there.

## Usage

See [the Laravel documentation](https://laravel.com/docs/5.5/filesystem)
Expand All @@ -47,6 +72,7 @@ use Storage;
// List all files recursively from the root of the Azure share:
$files = Storage::disk('azure-file-storage')->listAll();
dump($files);
// Example:
// array:25 [▼
Expand Down
16 changes: 16 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
14 changes: 13 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

namespace Academe\Laravel\AzureFileStorageDriver;

/**
* laravel Service Provider.
*/

use Storage;
use League\Flysystem\Filesystem;

Expand All @@ -11,12 +15,20 @@

class ServiceProvider extends ServiceProviderContract
{
/**
* @var string The name of the driver.
*/
const DRIVER_NAME = 'azure-file-storage';

/**
* Bootstrap the application services.
* Extend the storage filesystem withe the new driver.
*
* @return void
*/
public function boot()
{
Storage::extend('azure-file-storage', function ($app, $config) {
Storage::extend(self::DRIVER_NAME, function ($app, $config) {
$connectionString = sprintf(
'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s',
$config['storageAccount'],
Expand Down

0 comments on commit ab99a66

Please sign in to comment.