Skip to content

Commit ae7a9d0

Browse files
authored
Merge pull request #115 from nspyke/v3
Version 3
2 parents 52fa43d + 190be5d commit ae7a9d0

15 files changed

+229
-61
lines changed

.github/workflows/test.yaml

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,18 @@ jobs:
1717
coverage: none
1818
- name: php-cs-fixer
1919
run: |
20-
wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.19.0/php-cs-fixer.phar -q
20+
wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.11.0/php-cs-fixer.phar -q
2121
php php-cs-fixer.phar fix --dry-run --diff
2222
23-
tests-php-7-2-symfony-4-4:
24-
runs-on: ubuntu-latest
25-
env:
26-
SYMFONY_VERSION: 4.4.*
27-
steps:
28-
- uses: actions/checkout@master
29-
- uses: shivammathur/setup-php@v2
30-
with:
31-
php-version: '7.2'
32-
coverage: none
33-
- name: PHPUnit
34-
run: |
35-
composer require --no-update symfony/config=$SYMFONY_VERSION symfony/http-kernel=$SYMFONY_VERSION symfony/dependency-injection=$SYMFONY_VERSION symfony/options-resolver=$SYMFONY_VERSION
36-
composer require --no-update --dev symfony/framework-bundle=$SYMFONY_VERSION symfony/yaml=$SYMFONY_VERSION
37-
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
38-
php vendor/bin/simple-phpunit
39-
40-
tests-php-7-4-symfony-5-3:
23+
tests-php-8-0-symfony-5-4:
4124
runs-on: ubuntu-latest
4225
env:
43-
SYMFONY_VERSION: 5.3.*
26+
SYMFONY_VERSION: 5.4.*
4427
steps:
4528
- uses: actions/checkout@master
4629
- uses: shivammathur/setup-php@v2
4730
with:
48-
php-version: '7.4'
31+
php-version: '8.0'
4932
coverage: none
5033
- name: PHPUnit
5134
run: |
@@ -54,10 +37,10 @@ jobs:
5437
composer update --prefer-dist --no-interaction --no-ansi --no-progress
5538
php vendor/bin/simple-phpunit
5639
57-
tests-php-8-0-symfony-5-4:
40+
tests-php-8-0-symfony-6-0:
5841
runs-on: ubuntu-latest
5942
env:
60-
SYMFONY_VERSION: 5.4.*
43+
SYMFONY_VERSION: 6.0.*
6144
steps:
6245
- uses: actions/checkout@master
6346
- uses: shivammathur/setup-php@v2
@@ -71,10 +54,10 @@ jobs:
7154
composer update --prefer-dist --no-interaction --no-ansi --no-progress
7255
php vendor/bin/simple-phpunit
7356
74-
tests-php-8-1-symfony-6-0:
57+
tests-php-8-1-symfony-6-1:
7558
runs-on: ubuntu-latest
7659
env:
77-
SYMFONY_VERSION: 6.0.*
60+
SYMFONY_VERSION: 6.1.*
7861
steps:
7962
- uses: actions/checkout@master
8063
- uses: shivammathur/setup-php@v2

.php-cs-fixer.dist.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
4+
$config = new PhpCsFixer\Config();
5+
6+
return $config->setRules([
7+
'@Symfony' => true,
8+
'phpdoc_annotation_without_dot' => false,
9+
])
10+
->setFinder($finder);

.php_cs.dist

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ library into Symfony applications.
1111
It provides an efficient abstraction for the filesystem in order to change the storage backend depending
1212
on the execution environment (local files in development, cloud storage in production and memory in tests).
1313

14-
> Note: you are reading the documentation for flysystem-bundle 2.0, which relies on Flysystem 2 or Flysystem 3.
15-
> If you use Flysystem 1.X, use [flysystem-bundle 1.X](https://github.com/thephpleague/flysystem-bundle/tree/1.x).
14+
> Note: you are reading the documentation for flysystem-bundle 3.0, which relies on Flysystem 3.
15+
> If you use Flysystem 1.X, use [flysystem-bundle 1.X](https://github.com/thephpleague/flysystem-bundle/tree/1.x).
16+
> If you use Flysystem 2.X, use [flysystem-bundle 2.X](https://github.com/thephpleague/flysystem-bundle/tree/2.3.0).
1617
> Read the [Upgrade guide](https://github.com/thephpleague/flysystem-bundle/blob/master/UPGRADE.md) to learn how to upgrade.
1718
1819
## Installation
1920

20-
flysystem-bundle requires PHP 7.2+ and Symfony 4.2+.
21+
flysystem-bundle requires PHP 8.0+ and Symfony 5.4+.
2122

2223
You can install the bundle using Symfony Flex:
2324

@@ -100,6 +101,7 @@ to interact with your storage.
100101
2. Cloud storage providers:
101102
[AsyncAws S3](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#asyncaws-s3),
102103
[AWS SDK S3](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#aws-sdk-s3),
104+
[Azure](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#azure),
103105
[Google Cloud Storage](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#google-cloud-storage),
104106
[DigitalOcean Spaces](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#digitalocean-spaces),
105107
[Scaleway Object Storage](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#scaleway-object-storage)

UPGRADE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,20 @@ In addition to the library updates, the bundle also changed a bit:
1515
* Drop support for Azure, Dropbox, Rackspace and WebDAV adapters (following the main library) ;
1616
* Drop support for null, cache, zip and replicate adapters (following the main library) ;
1717
* Drop support for plugins ;
18+
19+
# Upgrading from 2.0 to 3.0
20+
21+
flysystem-bundle 3.0 relies on Flysystem 3.0, PHP 8.0+ and Flysystem adapters 3.1+.
22+
23+
The changes in this version focus on dropping support for EOL versions of PHP and Symfony and
24+
adding support for Azure Blob Storage.
25+
No new backwards incompatible code changes have been directly introduced by this new bundle version.
26+
You should read the [Flysystem 3.x Change Log](https://github.com/thephpleague/flysystem/blob/3.x/CHANGELOG.md)
27+
for any changes that may effect you.
28+
29+
These changes are;
30+
31+
* Added support for Azure Blob Storage (`league/flysystem-azure-blob-storage ^3.1`)
32+
* Dropped support for PHP 7
33+
* Dropped support of `league/flysystem ^2.0` and older Flysystem adapters `league/flysystem-* ^2.0|3.0.*`
34+
* Dropped support for Symfony 4.2 to 5.3

composer.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "league/flysystem-bundle",
3-
"description": "Symfony bundle integrating Flysystem into Symfony 4.2+ applications",
3+
"description": "Symfony bundle integrating Flysystem into Symfony 4.4+ applications",
44
"type": "symfony-bundle",
55
"license": "MIT",
66
"authors": [
@@ -20,26 +20,27 @@
2020
}
2121
},
2222
"require": {
23-
"php": ">=7.2",
24-
"league/flysystem": "^2.1|^3.0",
25-
"symfony/config": "^4.2|^5.0|^6.0",
23+
"php": ">=8.0",
24+
"league/flysystem": "^3.0",
25+
"symfony/config": "^5.4|^6.0",
2626
"symfony/deprecation-contracts": "^2.1|^3",
27-
"symfony/http-kernel": "^4.2|^5.0|^6.0",
28-
"symfony/dependency-injection": "^4.2|^5.0|^6.0",
29-
"symfony/options-resolver": "^4.2|^5.0|^6.0"
27+
"symfony/http-kernel": "^5.4|^6.0",
28+
"symfony/dependency-injection": "^5.4|^6.0",
29+
"symfony/options-resolver": "^5.4|^6.0"
3030
},
3131
"require-dev": {
32-
"league/flysystem-async-aws-s3": "^2.0|^3.0",
33-
"league/flysystem-aws-s3-v3": "^2.0|^3.0",
34-
"league/flysystem-ftp": "^2.0|^3.0",
35-
"league/flysystem-google-cloud-storage": "^2.0|^3.0",
36-
"league/flysystem-memory": "^2.0|^3.0",
37-
"league/flysystem-sftp-v3": "^2.0|^3.0",
38-
"symfony/dotenv": "^4.2|^5.0|^6.0",
39-
"symfony/framework-bundle": "^4.2|^5.0|^6.0",
40-
"symfony/phpunit-bridge": "^5.2",
41-
"symfony/var-dumper": "^4.1|^5.0|^6.0",
42-
"symfony/yaml": "^4.2|^5.0|^6.0"
32+
"league/flysystem-async-aws-s3": "^3.1",
33+
"league/flysystem-aws-s3-v3": "^3.1",
34+
"league/flysystem-azure-blob-storage": "^3.1",
35+
"league/flysystem-ftp": "^3.1",
36+
"league/flysystem-google-cloud-storage": "^3.1",
37+
"league/flysystem-memory": "^3.1",
38+
"league/flysystem-sftp-v3": "^3.1",
39+
"symfony/dotenv": "^5.4|^6.0",
40+
"symfony/framework-bundle": "^5.4|^6.0",
41+
"symfony/phpunit-bridge": "^5.4|^6.0",
42+
"symfony/var-dumper": "^5.4|^6.0",
43+
"symfony/yaml": "^5.4|^6.0"
4344
},
4445
"conflict": {
4546
"league/flysystem-cached-adapter": "<1.0.9"

docs/2-cloud-storage-providers.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,36 @@ One of the core feature of Flysystem is its ability to interact easily with remo
44
including many cloud storage providers. This bundle provides the same level of support for these
55
cloud providers by providing corresponding adapters in the configuration.
66

7+
* [Azure](#azure)
78
* [AsyncAws S3](#asyncaws-s3)
89
* [AWS S3](#aws-sdk-s3)
910
* [DigitalOcean Spaces](#digitalocean-spaces)
1011
* [Scaleway Object Storage](#scaleway-object-storage)
1112
* [Google Cloud Storage](#google-cloud-storage)
1213

14+
## Azure
15+
16+
### Installation
17+
18+
```
19+
composer require league/flysystem-azure-blob-storage
20+
```
21+
22+
### Usage
23+
24+
```yaml
25+
# config/packages/flysystem.yaml
26+
27+
flysystem:
28+
storages:
29+
users.storage:
30+
adapter: 'azure'
31+
options:
32+
client: 'azure_client_service' # The service ID of the MicrosoftAzure\Storage\Blob\BlobRestProxy instance
33+
container: 'container_name'
34+
prefix: 'optional/path/prefix'
35+
```
36+
1337
## AsyncAws S3
1438
1539
### Installation

docs/B-configuration-reference.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ flysystem:
99
client: 'aws_client_service'
1010
bucket: 'bucket_name'
1111
prefix: 'optional/path/prefix'
12-
12+
1313
users2.storage:
14-
adapter: 'custom_adapter'
14+
adapter: 'azure'
15+
options:
16+
client: 'azure_client_service'
17+
container: 'container_name'
18+
prefix: 'optional/path/prefix'
1519

1620
users3.storage:
1721
adapter: 'ftp'
@@ -73,4 +77,6 @@ flysystem:
7377
options:
7478
source: 'flysystem_storage_service_to_use'
7579

80+
users10.storage:
81+
adapter: 'custom_adapter'
7682
```

src/Adapter/AdapterDefinitionFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __construct()
3131
$this->builders = [
3232
new Builder\AsyncAwsAdapterDefinitionBuilder(),
3333
new Builder\AwsAdapterDefinitionBuilder(),
34+
new Builder\AzureAdapterDefinitionBuilder(),
3435
new Builder\FtpAdapterDefinitionBuilder(),
3536
new Builder\GcloudAdapterDefinitionBuilder(),
3637
new Builder\LocalAdapterDefinitionBuilder(),
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the flysystem-bundle project.
5+
*
6+
* (c) Titouan Galopin <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace League\FlysystemBundle\Adapter\Builder;
13+
14+
use League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter;
15+
use Symfony\Component\DependencyInjection\Definition;
16+
use Symfony\Component\DependencyInjection\Reference;
17+
use Symfony\Component\OptionsResolver\OptionsResolver;
18+
19+
/**
20+
* @author Titouan Galopin <[email protected]>
21+
*
22+
* @internal
23+
*/
24+
class AzureAdapterDefinitionBuilder extends AbstractAdapterDefinitionBuilder
25+
{
26+
public function getName(): string
27+
{
28+
return 'azure';
29+
}
30+
31+
protected function getRequiredPackages(): array
32+
{
33+
return [
34+
AzureBlobStorageAdapter::class => 'league/flysystem-azure-blob-storage',
35+
];
36+
}
37+
38+
protected function configureOptions(OptionsResolver $resolver)
39+
{
40+
$resolver->setRequired('client');
41+
$resolver->setAllowedTypes('client', 'string');
42+
43+
$resolver->setRequired('container');
44+
$resolver->setAllowedTypes('container', 'string');
45+
46+
$resolver->setDefault('prefix', '');
47+
$resolver->setAllowedTypes('prefix', 'string');
48+
}
49+
50+
protected function configureDefinition(Definition $definition, array $options)
51+
{
52+
$definition->setClass(AzureBlobStorageAdapter::class);
53+
$definition->setArgument(0, new Reference($options['client']));
54+
$definition->setArgument(1, $options['container']);
55+
$definition->setArgument(2, $options['prefix']);
56+
}
57+
}

0 commit comments

Comments
 (0)