-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Azure Blob Storage adapter (#271)
Co-authored-by: MD Nurullah <[email protected]> Co-authored-by: David Greminger <[email protected]>
- Loading branch information
1 parent
36449c1
commit 33bb123
Showing
9 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ jobs: | |
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: 7.4 | ||
php-version: 8.0 | ||
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib | ||
coverage: none | ||
|
||
|
@@ -36,12 +36,8 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [7.4, 8.0, 8.1] | ||
php: [8.0, 8.1] | ||
symfony: [4.4, 5.4, 6.0] | ||
exclude: | ||
# Symfony 6.0 does not supports php <8.0 | ||
- php: 7.4 | ||
symfony: 6.0 | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
|
@@ -67,7 +63,7 @@ jobs: | |
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: 7.4 | ||
php-version: 8.0 | ||
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib | ||
coverage: none | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Use the Azure Blob Storage adapter | ||
|
||
This adapter connects to the filesystem in the Azure Blob Storage. | ||
|
||
|
||
```yml | ||
oneup_flysystem: | ||
adapters: | ||
acme.flysystem_adapter: | ||
azureblob: | ||
client: 'azure_blob_storage_client' # Service ID of the MicrosoftAzure\Storage\Blob\BlobRestProxy | ||
container: 'container-name' | ||
prefix: 'optional/prefix' | ||
``` | ||
For more details on the other parameters, take a look at the [Flysystem documentation](https://flysystem.thephpleague.com/docs/adapter/azure-blob-storage/). | ||
## More to know | ||
* [Create and use your filesystem](filesystem_create.md) |
This file contains 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
40 changes: 40 additions & 0 deletions
40
src/DependencyInjection/Factory/Adapter/AzureBlobFactory.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Oneup\FlysystemBundle\DependencyInjection\Factory\Adapter; | ||
|
||
use Oneup\FlysystemBundle\DependencyInjection\Factory\AdapterFactoryInterface; | ||
use Symfony\Component\Config\Definition\Builder\NodeDefinition; | ||
use Symfony\Component\DependencyInjection\ChildDefinition; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
class AzureBlobFactory implements AdapterFactoryInterface | ||
{ | ||
public function getKey(): string | ||
{ | ||
return 'azureblob'; | ||
} | ||
|
||
public function create(ContainerBuilder $container, string $id, array $config): void | ||
{ | ||
$container | ||
->setDefinition($id, new ChildDefinition('oneup_flysystem.adapter.azureblob')) | ||
->replaceArgument(0, new Reference($config['client'])) | ||
->replaceArgument(1, $config['container']) | ||
->replaceArgument(2, $config['prefix']) | ||
; | ||
} | ||
|
||
public function addConfiguration(NodeDefinition $node): void | ||
{ | ||
$node | ||
->children() | ||
->scalarNode('client')->isRequired()->end() | ||
->scalarNode('container')->isRequired()->end() | ||
->scalarNode('prefix')->defaultNull()->end() | ||
->end() | ||
; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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