GithubHelp home page GithubHelp logo

jenkoian / flysystem-gaufrette Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 0.0 17 KB

A flysystem adapter to use Gaufrette without changing the API

License: MIT License

PHP 100.00%
flysystem php gaufrette flysystem-adapter

flysystem-gaufrette's Introduction

Flysystem Adapter for Gaufrette

Build Status Coverage Status Quality Score Software License

Installation

composer require jenko/flysystem-gaufrette

Usage

Basic usage:

use Jenko\Flysystem\GaufretteAdapter;
use Gaufrette\Adapter\Local;

$adapter = new GaufretteAdapter(
    new Local(__DIR__ . '/path/to/files');
); 

$filesystem = new Filesystem($adapter);

Advanced usage:

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 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 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 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
  • setVisibility

The 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

flysystem-gaufrette's People

Contributors

jenkoian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.