Skip to content

Commit 2da43e8

Browse files
authored
Merge pull request thephpleague#59 from Lustmored/flysystem-v2
Update bundle to support Flysystem v2
2 parents f314ffd + 88158a7 commit 2da43e8

50 files changed

Lines changed: 137 additions & 1518 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@master
2424
- uses: shivammathur/setup-php@v2
2525
with:
26-
php-version: '7.1'
26+
php-version: '7.2'
2727
- name: PHPUnit
2828
run: |
2929
composer require --no-update symfony/config=$SYMFONY_VERSION symfony/http-kernel=$SYMFONY_VERSION symfony/dependency-injection=$SYMFONY_VERSION symfony/options-resolver=$SYMFONY_VERSION

README.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ creates a named alias for each of these services.
4747

4848
This means you have two way of using the defined storages:
4949

50-
* either using autowiring, by typehinting against the `FilesystemInterface` and using the
50+
* either using autowiring, by typehinting against the `FilesystemOperator` and using the
5151
variable name matching one of your storages:
5252

5353
```php
54-
use League\Flysystem\FilesystemInterface;
54+
use League\Flysystem\FilesystemOperator;
5555
5656
class MyService
5757
{
5858
private $storage;
5959
6060
// The variable name $defaultStorage matters: it needs to be the camelized version
6161
// of the name of your storage.
62-
public function __construct(FilesystemInterface $defaultStorage)
62+
public function __construct(FilesystemOperator $defaultStorage)
6363
{
6464
$this->storage = $defaultStorage;
6565
}
@@ -71,13 +71,13 @@ This means you have two way of using the defined storages:
7171
The same goes for controllers:
7272

7373
```php
74-
use League\Flysystem\FilesystemInterface;
74+
use League\Flysystem\FilesystemOperator;
7575
7676
class MyController
7777
{
7878
// The variable name $defaultStorage matters: it needs to be the camelized version
7979
// of the name of your storage.
80-
public function index(FilesystemInterface $defaultStorage)
80+
public function index(FilesystemOperator $defaultStorage)
8181
{
8282
// ...
8383
}
@@ -87,26 +87,20 @@ This means you have two way of using the defined storages:
8787
* or using manual injection, by injecting the service named `default.storage` inside
8888
your services.
8989

90-
Once you have a FilesystemInterface, you can call methods from the
91-
[Filesystem API](https://flysystem.thephpleague.com/docs/usage/filesystem-api/)
90+
Once you have a FilesystemOperator, you can call methods from the
91+
[Filesystem API](https://flysystem.thephpleague.com/v2/docs/usage/filesystem-api/)
9292
to interact with your storage.
9393

9494
## Full documentation
9595

96-
1. [Getting started](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/1-getting-started.md)
96+
1. [Getting started](https://flysystem.thephpleague.com/v2/docs/getting-started/)
9797
2. Cloud storage providers:
98-
[Azure](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#azure),
9998
[AsyncAws S3](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#asyncaws-s3),
10099
[AWS S3](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#aws-s3),
101-
[DigitalOcean Spaces](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#digitalocean-spaces),
102-
[Scaleway Object Storage](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#scaleway-object-storage),
103-
[Google Cloud Storage](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#google-cloud-storage),
104-
[Rackspace](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#rackspace),
105-
[WebDAV](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#webdav)
100+
[Google Cloud Storage](https://flysystem.thephpleague.com/v2/docs/adapter/gcs/),
106101
3. [Interacting with FTP and SFTP servers](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/3-interacting-with-ftp-and-sftp-servers.md)
107-
4. [Caching metadata in Symfony cache](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/4-caching-metadata-in-symfony-cache.md)
108-
5. [Using a lazy adapter to switch storage backend using an environment variable](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/5-using-lazy-adapter-to-switch-at-runtime.md)
109-
6. [Creating a custom adapter](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/6-creating-a-custom-adapter.md)
102+
4. [Using a lazy adapter to switch storage backend using an environment variable](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/5-using-lazy-adapter-to-switch-at-runtime.md)
103+
5. [Creating a custom adapter](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/6-creating-a-custom-adapter.md)
110104

111105
* [Security issue disclosure procedure](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/A-security-disclosure-procedure.md)
112106
* [Configuration reference](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/B-configuration-reference.md)

composer.json

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,28 @@
2020
}
2121
},
2222
"require": {
23-
"php": ">=7.1",
24-
"league/flysystem": "^1.0.40",
23+
"php": ">=7.2",
24+
"league/flysystem": "^2.0",
2525
"symfony/config": "^4.2|^5.0",
2626
"symfony/http-kernel": "^4.2|^5.0",
2727
"symfony/dependency-injection": "^4.2|^5.0",
2828
"symfony/options-resolver": "^4.2|^5.0"
2929
},
3030
"require-dev": {
31-
"async-aws/flysystem-s3": "^1.0",
32-
"league/flysystem-aws-s3-v3": "^1.0.22",
33-
"league/flysystem-azure-blob-storage": "^0.1.5",
34-
"league/flysystem-cached-adapter": "^1.0.9",
35-
"league/flysystem-memory": "^1.0",
36-
"league/flysystem-rackspace": "^1.0",
37-
"league/flysystem-replicate-adapter": "^1.0",
38-
"league/flysystem-sftp": "^1.0",
39-
"league/flysystem-webdav": "^1.0",
40-
"league/flysystem-ziparchive": "^1.0",
31+
"async-aws/flysystem-s3": "^0.3",
32+
"league/flysystem-aws-s3-v3": "^2.0",
33+
"league/flysystem-ftp": "^2.0",
34+
"league/flysystem-google-cloud-storage": "^2.0",
35+
"league/flysystem-memory": "^2.0",
36+
"league/flysystem-sftp": "^2.0",
4137
"phpunit/phpunit": "^7.4",
42-
"spatie/flysystem-dropbox": "^1.0",
43-
"superbalist/flysystem-google-storage": "^7.2",
4438
"symfony/dotenv": "^4.2|^5.0",
4539
"symfony/framework-bundle": "^4.2|^5.0",
4640
"symfony/var-dumper": "^4.1|^5.0",
4741
"symfony/yaml": "^4.2|^5.0"
4842
},
4943
"conflict": {
5044
"league/flysystem-aws-s3-v3": "<1.0.22",
51-
"async-aws/flysystem-s3": "<1.0",
5245
"league/flysystem-cached-adapter": "<1.0.9"
5346
},
5447
"config": {

docs/1-getting-started.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ creates a named alias for each of these services.
4040

4141
This means you have two way of using the defined storages:
4242

43-
* either using autowiring, by typehinting against the `FilesystemInterface` and using the
43+
* either using autowiring, by typehinting against the `FilesystemOperator` and using the
4444
variable name matching one of your storages:
4545

4646
```php
47-
use League\Flysystem\FilesystemInterface;
47+
use League\Flysystem\FilesystemOperator;
4848
4949
class MyService
5050
{
5151
private $storage;
5252
5353
// The variable name $defaultStorage matters: it needs to be the camelized version
5454
// of the name of your storage.
55-
public function __construct(FilesystemInterface $defaultStorage)
55+
public function __construct(FilesystemOperator $defaultStorage)
5656
{
5757
$this->storage = $defaultStorage;
5858
}
@@ -64,13 +64,13 @@ This means you have two way of using the defined storages:
6464
The same goes for controllers:
6565

6666
```php
67-
use League\Flysystem\FilesystemInterface;
67+
use League\Flysystem\FilesystemOperator;
6868
6969
class MyController
7070
{
7171
// The variable name $defaultStorage matters: it needs to be the camelized version
7272
// of the name of your storage.
73-
public function index(FilesystemInterface $defaultStorage)
73+
public function index(FilesystemOperator $defaultStorage)
7474
{
7575
// ...
7676
}
@@ -80,8 +80,8 @@ This means you have two way of using the defined storages:
8080
* or using manual injection, by injecting the service named `default.storage` inside
8181
your services.
8282

83-
Once you have a FilesystemInterface, you can call methods from the
84-
[Filesystem API](https://flysystem.thephpleague.com/docs/usage/filesystem-api/)
83+
Once you have a FilesystemOperator, you can call methods from the
84+
[Filesystem API](https://flysystem.thephpleague.com/v2/docs/usage/filesystem-api/)
8585
to interact with your storage.
8686

8787

@@ -111,14 +111,14 @@ flysystem:
111111
```
112112

113113
```php
114-
use League\Flysystem\FilesystemInterface;
114+
use League\Flysystem\FilesystemOperator;
115115
116116
class MyService
117117
{
118118
private $usersStorage;
119119
private $projectsStorage;
120120
121-
public function __construct(FilesystemInterface $usersStorage, FilesystemInterface $projectsStorage)
121+
public function __construct(FilesystemOperator $usersStorage, FilesystemOperator $projectsStorage)
122122
{
123123
$this->usersStorage = $usersStorage;
124124
$this->projectsStorage = $projectsStorage;
@@ -160,7 +160,7 @@ flysystem:
160160
```
161161

162162
This configuration will swap every reference to the `users.storage` service (or to the
163-
`FilesystemInterface $usersStorage` typehint) from a local adapter to a memory one during tests.
163+
`FilesystemOperator $usersStorage` typehint) from a local adapter to a memory one during tests.
164164

165165
## Next
166166

docs/2-cloud-storage-providers.md

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,11 @@ 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)
87
* [AsyncAws S3](#asyncaws-s3)
98
* [AWS S3](#aws-s3)
109
* [DigitalOcean Spaces](#digitalocean-spaces)
1110
* [Scaleway Object Storage](#scaleway-object-storage)
1211
* [Google Cloud Storage](#google-cloud-storage)
13-
* [Rackspace](#rackspace)
14-
* [WebDAV](#webdav)
15-
16-
## Azure
17-
18-
### Installation
19-
20-
```
21-
composer require league/flysystem-azure-blob-storage
22-
```
23-
24-
### Usage
25-
26-
```yaml
27-
# config/packages/flysystem.yaml
28-
29-
flysystem:
30-
storages:
31-
users.storage:
32-
adapter: 'azure'
33-
options:
34-
client: 'azure_client_service' # The service ID of the MicrosoftAzure\Storage\Blob\BlobRestProxy instance
35-
container: 'container_name'
36-
prefix: 'optional/path/prefix'
37-
```
3812

3913
## AsyncAws S3
4014

@@ -93,34 +67,12 @@ as for a AWS storage.
9367
The Scaleway Object Storage is compatible with the AWS S3 API, meaning that you can use the same configuration
9468
as for a AWS storage.
9569
96-
## Dropbox
97-
98-
### Installation
99-
100-
```
101-
composer require spatie/flysystem-dropbox
102-
```
103-
104-
### Usage
105-
106-
```yaml
107-
# config/packages/flysystem.yaml
108-
109-
flysystem:
110-
storages:
111-
users.storage:
112-
adapter: 'dropbox'
113-
options:
114-
client: 'dropbox_client_service' # The service ID of the Spatie\Dropbox\Client instance
115-
prefix: 'optional/path/prefix'
116-
```
117-
11870
## Google Cloud Storage
11971
12072
### Installation
12173
12274
```
123-
composer require superbalist/flysystem-google-storage
75+
composer require league/flysystem-google-cloud-storage
12476
```
12577

12678
### Usage
@@ -136,52 +88,6 @@ flysystem:
13688
client: 'gcloud_client_service' # The service ID of the Google\Cloud\Storage\StorageClient instance
13789
bucket: 'bucket_name'
13890
prefix: 'optional/path/prefix'
139-
api_url: 'https://storage.googleapis.com'
140-
```
141-
142-
## Rackspace
143-
144-
### Installation
145-
146-
```
147-
composer require league/flysystem-rackspace
148-
```
149-
150-
### Usage
151-
152-
```yaml
153-
# config/packages/flysystem.yaml
154-
155-
flysystem:
156-
storages:
157-
users.storage:
158-
adapter: 'rackspace'
159-
options:
160-
container: 'rackspace_container_service' # The service ID of the OpenCloud\ObjectStore\Resource\Container instance
161-
prefix: 'optional/path/prefix'
162-
```
163-
164-
## WebDAV
165-
166-
### Installation
167-
168-
```
169-
composer require league/flysystem-webdav
170-
```
171-
172-
### Usage
173-
174-
```yaml
175-
# config/packages/flysystem.yaml
176-
177-
flysystem:
178-
storages:
179-
users.storage:
180-
adapter: 'webdav'
181-
options:
182-
client: 'webdav_client_service' # The service ID of the Sabre\DAV\Client instance
183-
prefix: 'optional/path/prefix'
184-
use_stream_copy: false
18591
```
18692
18793
## Next

docs/3-interacting-with-ftp-and-sftp-servers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Interacting with FTP and SFTP servers
22

3-
Flysystem is able to interact with FTP and SFTP servers using the same FilesystemInterface.
3+
Flysystem is able to interact with FTP and SFTP servers using the same FilesystemOperator.
44
To configure this bundle for such usage, you can rely on adapters in the same way you would
55
for other storages.
66

@@ -64,4 +64,4 @@ flysystem:
6464
6565
## Next
6666
67-
[Caching metadata in Symfony cache](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/4-caching-metadata-in-symfony-cache.md)
67+
[Using a lazy adapter to switch storage backend using an environment variable](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/5-using-lazy-adapter-to-switch-at-runtime.md)

0 commit comments

Comments
 (0)