https://github.com/jenkoian/flysystem-gaufrette
A flysystem adapter to use Gaufrette without changing the API
https://github.com/jenkoian/flysystem-gaufrette
flysystem flysystem-adapter gaufrette php
Last synced: about 2 months ago
JSON representation
A flysystem adapter to use Gaufrette without changing the API
- Host: GitHub
- URL: https://github.com/jenkoian/flysystem-gaufrette
- Owner: jenkoian
- License: mit
- Created: 2016-03-07T15:43:20.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-30T14:54:53.000Z (almost 4 years ago)
- Last Synced: 2024-11-13T17:49:22.986Z (6 months ago)
- Topics: flysystem, flysystem-adapter, gaufrette, php
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [Flysystem](https://github.com/thephpleague/flysystem) Adapter for [Gaufrette](https://github.com/KnpLabs/Gaufrette)
[](https://travis-ci.org/jenkoian/flysystem-gaufrette)
[](https://scrutinizer-ci.com/g/jenkoian/flysystem-gaufrette/code-structure)
[](https://scrutinizer-ci.com/g/jenkoian/flysystem-gaufrette)
[](LICENSE)## Installation
```bash
composer require jenko/flysystem-gaufrette
```## Usage
Basic usage:
```php
use Jenko\Flysystem\GaufretteAdapter;
use Gaufrette\Adapter\Local;$adapter = new GaufretteAdapter(
new Local(__DIR__ . '/path/to/files');
);$filesystem = new Filesystem($adapter);
```Advanced usage:
```php
use Jenko\Flysystem\GaufretteAdapter;
use Gaufrette\Adapter\Local;
use Gaufrette\Adapter\Flysystem;// Hadouken!
$adapter = new GaufretteAdapter(
new Flysystem(
new GaufretteAdapter(
new Flysystem(
new GaufretteAdapter(
new Flysystem(
new GaufretteAdapter(
new Local(
__DIR__ . '/path/to/files'
)
)
)
)
)
)
)
);$filesystem = new Filesystem($adapter);
```## Wait, what?
[Gaufrette added a Flysystem adapter](https://github.com/KnpLabs/Gaufrette/blob/master/doc/adapters/flysystem.md) so it made sense to reciprocate the love and have an adapter going in the other direction.
Although it does feel a little [yo dawg](https://cloud.githubusercontent.com/assets/993350/13571485/99fd5f90-e475-11e5-9f2c-04dea88713fd.png) it is useful. For example
if you have a codebase which is quite coupled to the flysystem API (legacy app, obv you wouldn't have done this) but wish to make a switch to Gaufrette, this will allow you to do so without having to go through
your codebase changing all calls to the old API. For more information on actual usage, see this blog post: http://jenko.me/legacy/2017/03/07/from-gaufrette-to-flysystem-and-back-again/It also allows you to construct fun, bi-directional, [hadouken-esque](https://imgur.com/BtjZedW) nesting as seen in the advanced usage example above.
## Unsupported methods
Flysystem has a few methods which Gaufrette doesn't quite support, these are listed below:
* update
* updateStream
* copy
* createDir
* getVisibility
* setVisibilityThe following methods are only supported for Gaufrette adapters implementing `MetadataSupporter`:
* getMetadata
The following methods are only supported for Gaufrette adapters implementing `SizeCalculator`:
* getSize
The following methods are only supported for Gaufrette adapters implementing `MimeTypeProvider`:
* getMimetype