Studio-42/elFinder — pull request #928 by barryvdh (2014-12-02 08:31:26+00:00)
Title: [WIP] Add Flysystem driver

This is a Volume Driver for Flysystem (https://github.com/thephpleague/flysystem)
This makes it easy to use Local, (S)FTP, AWS, Dropbox, etc without writing custom volume drivers..

This is tested against the latest `dev-master`, but a stable 1.x release should come soon. Probably best to wait before the final changes.

TODO:
- [ ] Check all adapters (Tested: SFTP + Local)
- [ ] Think about best practice, should a FileSystem instance be passed, or just the Adapter?
- [ ] Simplify the path: is the path needed, or just use the root from the adapter?
- [ ] Wait for final (1.x) release

Example usage: pass a Flysystem instance to the options. Path can be '/' to use the root, or a relative path.

use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\LocalAdapter;
use League\Flysystem\Adapter\SftpAdapter;

// Local Adapter
array(
'driver' => 'Flysystem', // driver for accessing file system (REQUIRED)
'path' => '/', // path to files (REQUIRED)
'URL' => asset('content'), // URL to files (REQUIRED)
'filesystem' => new Filesystem(new LocalAdapter('/var/www/html/content'))
),

// SFTP Adapter
array(
'driver' => 'Flysystem', // driver for accessing file system (REQUIRED)
'path' => 'content', // path to files (REQUIRED)
'URL' => asset('content'), // URL to files (REQUIRED)
'filesystem' => new Filesystem(new SftpAdapter(
[
'host' => 'localhost',
'username' => 'username',
'password' => '123',
'root' => '/var/www/html',
]
)),
),

Any thoughts?