Skip to content

Commit

Permalink
Update docs for new interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Caban committed Dec 10, 2020
1 parent 499bbaa commit 6af3083
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 31 deletions.
22 changes: 8 additions & 14 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,22 +87,16 @@ 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)
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)
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
2 changes: 1 addition & 1 deletion 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
6 changes: 3 additions & 3 deletions docs/5-using-lazy-adapter-to-switch-at-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ APP_UPLOADS_SOURCE=uploads.storage.memory
Other than being created at runtime, the `lazy` adapter is behaving in the exact
same way as any other storage:

* you can use it with autowiring, by typehinting against the `FilesystemInterface` and using the
* you can use it with autowiring, by typehinting against the `FilesystemOperator` and using the
variable name matching its name:

```php
use League\Flysystem\FilesystemInterface;
use League\Flysystem\FilesystemOperator;
class MyService
{
private $storage;
public function __construct(FilesystemInterface $uploadsStorage)
public function __construct(FilesystemOperator $uploadsStorage)
{
$this->storage = $uploadsStorage;
}
Expand Down
4 changes: 2 additions & 2 deletions docs/6-creating-a-custom-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ and then use it in your storages configuration.

## Creating the adapter class

A Flysystem adapter is a class implementing the `League\Flysystem\AdapterInterface` interface.
A Flysystem adapter is a class implementing the `League\Flysystem\FilesystemAdapter` interface.
To learn all the details about how to create this class, you can read the
[library documentation](https://flysystem.thephpleague.com/docs/advanced/creating-an-adapter/).
[library documentation](https://flysystem.thephpleague.com/v2/docs/advanced/creating-an-adapter/).

You can create this class everywhere you want in your application. We usually recommend a clear
namespace and class name such as `App\Flysystem\MyCustomAdapter`.
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/FlysystemExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testFileystems(string $fsName)
$kernel = $this->createFysystemKernel();
$fs = $kernel->getContainer()->get('flysystem.test.'.$fsName);

$this->assertInstanceOf(FilesystemOperator::class, $fs, 'Filesystem "'.$fsName.'" should be an instance of FilesystemInterface');
$this->assertInstanceOf(FilesystemOperator::class, $fs, 'Filesystem "'.$fsName.'" should be an instance of FilesystemOperator');
}

/**
Expand Down

0 comments on commit 6af3083

Please sign in to comment.