Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bundle to support Flysystem v2 #59

Merged
merged 26 commits into from
Jan 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ec8bc89
Start working on v2
tgalopin Apr 4, 2020
6536b48
Update dependencies
Lustmored Nov 26, 2020
c093a7e
Port Adapter tests to new class names
Lustmored Nov 26, 2020
a92b57e
Adapt DI test
Lustmored Nov 26, 2020
728bf47
Fix class definition in tests and requirement checks
Lustmored Nov 26, 2020
180ebc6
Remove or comment not existing adapters
Lustmored Nov 26, 2020
42c0b0a
Fix / disable $options in Aws
Lustmored Nov 26, 2020
565d720
There are no plugins in Flysystem v2
Lustmored Nov 26, 2020
3efc53d
Adapt PHP versions from Flysystem
Lustmored Nov 26, 2020
3421d9d
Use PortableVisibilityConverter for LocalAdapter
Lustmored Nov 26, 2020
820f3b1
FTP uses FtpConnectionOption
Lustmored Nov 26, 2020
34c91ae
Sftp uses ConnectionProvider
Lustmored Nov 26, 2020
9e0164a
Delete plugin remainings
Lustmored Nov 26, 2020
beb8e13
Use newer PHP-CS-Fixer
Lustmored Nov 26, 2020
8880840
Add cache adapter based on lustmored/flysystem-v2-simple-cache-adapter
Lustmored Dec 10, 2020
8921dd0
Strip and change docs where needed
Lustmored Dec 10, 2020
daa1a9a
Update docs for new interfaces
Lustmored Dec 10, 2020
40a377f
Fix async AWS after rebase and nuke webdav tests
Lustmored Jan 7, 2021
7668244
Trivial docs and config changes per review
Lustmored Jan 7, 2021
0a92470
Update minimal version in tests
Lustmored Jan 7, 2021
524ce4b
Add Google Cloud adapter back
Lustmored Jan 7, 2021
fe500bc
Add Google Cloud to the docs again
Lustmored Jan 7, 2021
d95f779
Nuke .travis
Lustmored Jan 7, 2021
8d1203b
Remove unused code
Lustmored Jan 7, 2021
798d91d
Remove cache adapter
Lustmored Jan 7, 2021
88158a7
Nuke cache adapter from docs too
Lustmored Jan 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: '7.1'
php-version: '7.2'
- name: PHPUnit
run: |
composer require --no-update symfony/config=$SYMFONY_VERSION symfony/http-kernel=$SYMFONY_VERSION symfony/dependency-injection=$SYMFONY_VERSION symfony/options-resolver=$SYMFONY_VERSION
Expand Down
28 changes: 11 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ creates a named alias for each of these services.

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

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

```php
use League\Flysystem\FilesystemInterface;
use League\Flysystem\FilesystemOperator;

class MyService
{
private $storage;

// The variable name $defaultStorage matters: it needs to be the camelized version
// of the name of your storage.
public function __construct(FilesystemInterface $defaultStorage)
public function __construct(FilesystemOperator $defaultStorage)
{
$this->storage = $defaultStorage;
}
Expand All @@ -71,13 +71,13 @@ This means you have two way of using the defined storages:
The same goes for controllers:

```php
use League\Flysystem\FilesystemInterface;
use League\Flysystem\FilesystemOperator;

class MyController
{
// The variable name $defaultStorage matters: it needs to be the camelized version
// of the name of your storage.
public function index(FilesystemInterface $defaultStorage)
public function index(FilesystemOperator $defaultStorage)
{
// ...
}
Expand All @@ -87,26 +87,20 @@ This means you have two way of using the defined storages:
* or using manual injection, by injecting the service named `default.storage` inside
your services.

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

## Full documentation

1. [Getting started](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/1-getting-started.md)
1. [Getting started](https://flysystem.thephpleague.com/v2/docs/getting-started/)
2. Cloud storage providers:
[Azure](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#azure),
[AsyncAws S3](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#asyncaws-s3),
[AWS S3](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#aws-s3),
[DigitalOcean Spaces](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#digitalocean-spaces),
[Scaleway Object Storage](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#scaleway-object-storage),
[Google Cloud Storage](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#google-cloud-storage),
[Rackspace](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#rackspace),
[WebDAV](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/2-cloud-storage-providers.md#webdav)
[Google Cloud Storage](https://flysystem.thephpleague.com/v2/docs/adapter/gcs/),
3. [Interacting with FTP and SFTP servers](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/3-interacting-with-ftp-and-sftp-servers.md)
4. [Caching metadata in Symfony cache](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/4-caching-metadata-in-symfony-cache.md)
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)
6. [Creating a custom adapter](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/6-creating-a-custom-adapter.md)
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)
5. [Creating a custom adapter](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/6-creating-a-custom-adapter.md)

* [Security issue disclosure procedure](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/A-security-disclosure-procedure.md)
* [Configuration reference](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/B-configuration-reference.md)
Expand Down
23 changes: 8 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,28 @@
}
},
"require": {
"php": ">=7.1",
"league/flysystem": "^1.0.40",
"php": ">=7.2",
"league/flysystem": "^2.0",
"symfony/config": "^4.2|^5.0",
"symfony/http-kernel": "^4.2|^5.0",
"symfony/dependency-injection": "^4.2|^5.0",
"symfony/options-resolver": "^4.2|^5.0"
},
"require-dev": {
"async-aws/flysystem-s3": "^1.0",
"league/flysystem-aws-s3-v3": "^1.0.22",
"league/flysystem-azure-blob-storage": "^0.1.5",
"league/flysystem-cached-adapter": "^1.0.9",
"league/flysystem-memory": "^1.0",
"league/flysystem-rackspace": "^1.0",
"league/flysystem-replicate-adapter": "^1.0",
"league/flysystem-sftp": "^1.0",
"league/flysystem-webdav": "^1.0",
"league/flysystem-ziparchive": "^1.0",
"async-aws/flysystem-s3": "^0.3",
"league/flysystem-aws-s3-v3": "^2.0",
"league/flysystem-ftp": "^2.0",
"league/flysystem-google-cloud-storage": "^2.0",
"league/flysystem-memory": "^2.0",
"league/flysystem-sftp": "^2.0",
"phpunit/phpunit": "^7.4",
"spatie/flysystem-dropbox": "^1.0",
"superbalist/flysystem-google-storage": "^7.2",
"symfony/dotenv": "^4.2|^5.0",
"symfony/framework-bundle": "^4.2|^5.0",
"symfony/var-dumper": "^4.1|^5.0",
"symfony/yaml": "^4.2|^5.0"
},
"conflict": {
"league/flysystem-aws-s3-v3": "<1.0.22",
"async-aws/flysystem-s3": "<1.0",
"league/flysystem-cached-adapter": "<1.0.9"
},
"config": {
Expand Down
20 changes: 10 additions & 10 deletions docs/1-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ creates a named alias for each of these services.

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

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

```php
use League\Flysystem\FilesystemInterface;
use League\Flysystem\FilesystemOperator;

class MyService
{
private $storage;

// The variable name $defaultStorage matters: it needs to be the camelized version
// of the name of your storage.
public function __construct(FilesystemInterface $defaultStorage)
public function __construct(FilesystemOperator $defaultStorage)
{
$this->storage = $defaultStorage;
}
Expand All @@ -64,13 +64,13 @@ This means you have two way of using the defined storages:
The same goes for controllers:

```php
use League\Flysystem\FilesystemInterface;
use League\Flysystem\FilesystemOperator;

class MyController
{
// The variable name $defaultStorage matters: it needs to be the camelized version
// of the name of your storage.
public function index(FilesystemInterface $defaultStorage)
public function index(FilesystemOperator $defaultStorage)
{
// ...
}
Expand All @@ -80,8 +80,8 @@ This means you have two way of using the defined storages:
* or using manual injection, by injecting the service named `default.storage` inside
your services.

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


Expand Down Expand Up @@ -111,14 +111,14 @@ flysystem:
```

```php
use League\Flysystem\FilesystemInterface;
use League\Flysystem\FilesystemOperator;

class MyService
{
private $usersStorage;
private $projectsStorage;

public function __construct(FilesystemInterface $usersStorage, FilesystemInterface $projectsStorage)
public function __construct(FilesystemOperator $usersStorage, FilesystemOperator $projectsStorage)
{
$this->usersStorage = $usersStorage;
$this->projectsStorage = $projectsStorage;
Expand Down Expand Up @@ -160,7 +160,7 @@ flysystem:
```

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

## Next

Expand Down
96 changes: 1 addition & 95 deletions docs/2-cloud-storage-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,11 @@ One of the core feature of Flysystem is its ability to interact easily with remo
including many cloud storage providers. This bundle provides the same level of support for these
cloud providers by providing corresponding adapters in the configuration.

* [Azure](#azure)
* [AsyncAws S3](#asyncaws-s3)
* [AWS S3](#aws-s3)
* [DigitalOcean Spaces](#digitalocean-spaces)
* [Scaleway Object Storage](#scaleway-object-storage)
* [Google Cloud Storage](#google-cloud-storage)
* [Rackspace](#rackspace)
* [WebDAV](#webdav)

## Azure

### Installation

```
composer require league/flysystem-azure-blob-storage
```

### Usage

```yaml
# config/packages/flysystem.yaml

flysystem:
storages:
users.storage:
adapter: 'azure'
options:
client: 'azure_client_service' # The service ID of the MicrosoftAzure\Storage\Blob\BlobRestProxy instance
container: 'container_name'
prefix: 'optional/path/prefix'
```

## AsyncAws S3

Expand Down Expand Up @@ -93,34 +67,12 @@ as for a AWS storage.
The Scaleway Object Storage is compatible with the AWS S3 API, meaning that you can use the same configuration
as for a AWS storage.

## Dropbox

### Installation

```
composer require spatie/flysystem-dropbox
```

### Usage

```yaml
# config/packages/flysystem.yaml

flysystem:
storages:
users.storage:
adapter: 'dropbox'
options:
client: 'dropbox_client_service' # The service ID of the Spatie\Dropbox\Client instance
prefix: 'optional/path/prefix'
```

## Google Cloud Storage

### Installation

```
composer require superbalist/flysystem-google-storage
composer require league/flysystem-google-cloud-storage
```

### Usage
Expand All @@ -136,52 +88,6 @@ flysystem:
client: 'gcloud_client_service' # The service ID of the Google\Cloud\Storage\StorageClient instance
bucket: 'bucket_name'
prefix: 'optional/path/prefix'
api_url: 'https://storage.googleapis.com'
```

## Rackspace

### Installation

```
composer require league/flysystem-rackspace
```

### Usage

```yaml
# config/packages/flysystem.yaml

flysystem:
storages:
users.storage:
adapter: 'rackspace'
options:
container: 'rackspace_container_service' # The service ID of the OpenCloud\ObjectStore\Resource\Container instance
prefix: 'optional/path/prefix'
```

## WebDAV

### Installation

```
composer require league/flysystem-webdav
```

### Usage

```yaml
# config/packages/flysystem.yaml

flysystem:
storages:
users.storage:
adapter: 'webdav'
options:
client: 'webdav_client_service' # The service ID of the Sabre\DAV\Client instance
prefix: 'optional/path/prefix'
use_stream_copy: false
```

## Next
Expand Down
4 changes: 2 additions & 2 deletions docs/3-interacting-with-ftp-and-sftp-servers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Interacting with FTP and SFTP servers

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

Expand Down Expand Up @@ -64,4 +64,4 @@ flysystem:

## Next

[Caching metadata in Symfony cache](https://github.com/thephpleague/flysystem-bundle/blob/master/docs/4-caching-metadata-in-symfony-cache.md)
[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)
Loading