Coder Social home page Coder Social logo

laravel-azure-blob-storage's Introduction

laravel-azure-blob-storage

Build Status

Microsoft Azure Blob Storage integration for Laravel's Storage API

This package uses the new azure storage blob package and extends the AzureBlobStorageAdapter package for specific Laravel functions. You can also use this on frameworks with Flysystem Filesystem support.

Installation

Install the package using composer when using Laravel 9 and higher:

composer require steffjenl/laravel-azure-blob-storage

Install the package using composer when using Laravel 8 and lower:

composer require steffjenl/laravel-azure-blob-storage:1.0.5

On Laravel versions before 5.5 you also need to add the service provider to config/app.php manually:

    SteffjeNL\LaravelAzureBlobStorage\AzureBlobStorageServiceProvider::class,

Then add this to the disks section of config/filesystems.php:

        'azure' => [
            'driver'            => 'azure',
            'local_address'     => env('AZURE_STORAGE_LOCAL_ADDRESS', null),
            'name'              => env('AZURE_STORAGE_NAME'),
            'key'               => env('AZURE_STORAGE_KEY'),
            'container'         => env('AZURE_STORAGE_CONTAINER'),
            'prefix'            => env('AZURE_STORAGE_PREFIX', ''),
            'url'               => env('AZURE_STORAGE_URL', null),
        ],

Finally, add the fields AZURE_STORAGE_NAME, AZURE_STORAGE_KEY and AZURE_STORAGE_CONTAINER to your .env file with the appropriate credentials. Then you can set the azure driver as either your default or cloud driver and use it to fetch and retrieve files as usual.

Configuration

If you use a DSN you can enter your DNS address in the AZURE_STORAGE_URL field

If you want to use a prefix so that you always work in a specific folder, you can use the AZURE_STORAGE_PREFIX field

If you want to use Storage Emulator you can set AZURE_STORAGE_LOCAL_ADDRESS to local. If your storage emulator is on an external machine you can change the AZURE_STORAGE_LOCAL_ADDRESS other than local. When using local the connection string will be UseDevelopmentStorage=true.

Example config for local emulator

AZURE_STORAGE_LOCAL_ADDRESS=local
AZURE_STORAGE_NAME=devstoreaccount1
AZURE_STORAGE_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
AZURE_STORAGE_CONTAINER=CONTAINER_NAME_HERE

Example config for remote emulator

AZURE_STORAGE_LOCAL_ADDRESS=http://192.168.0.2:10000/devstoreaccount1
AZURE_STORAGE_NAME=devstoreaccount1
AZURE_STORAGE_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
AZURE_STORAGE_CONTAINER=CONTAINER_NAME_HERE

laravel-azure-blob-storage's People

Contributors

rintdev avatar steffjenl avatar tvanhateren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-azure-blob-storage's Issues

Undefined index: local_address

Getting the following error code:
Undefined index: local_address

Usage examples:
return response()->download(Storage::url($document->file), $document->file);
return response()->download(Storage::path($document->file), $document->file);

It's referring to line 32 in AzureBlobStorageServiceProvider.php

Laravel version 5.8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.