Created
August 24, 2015 05:59
-
-
Save pengan1987/8cf5872a6042dc150016 to your computer and use it in GitHub Desktop.
Laravel 5 Windows Azure file system driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php namespace App\Providers; | |
| use Illuminate\Support\ServiceProvider; | |
| use League\Flysystem\Azure\AzureAdapter; | |
| use League\Flysystem\Filesystem; | |
| use Storage; | |
| use WindowsAzure\Common\ServicesBuilder; | |
| /** | |
| * Laravel 5 Windows Azure file system driver | |
| * Reference: http://laravel.com/docs/5.0/filesystem | |
| * Class AzureBlobServiceProvider | |
| * @package App\Providers | |
| */ | |
| class AzureBlobServiceProvider extends ServiceProvider | |
| { | |
| public function boot() | |
| { | |
| Storage::extend('azureblob', function ($app, $config) { | |
| $endpoint = sprintf('DefaultEndpointsProtocol=%s;AccountName=%s;AccountKey=%s', | |
| $config['protocol'], | |
| $config['account'], | |
| $config['apikey']); | |
| if ($config['emulator']) { | |
| $endpoint = 'UseDevelopmentStorage=true'; | |
| } | |
| $blobRestProxy = ServicesBuilder::getInstance()->createBlobService($endpoint); | |
| return new Filesystem(new AzureAdapter($blobRestProxy, $config['container'])); | |
| }); | |
| } | |
| public function register() | |
| { | |
| // | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment