抽象化的文件系统:Flysystem

jopen 9年前

Flysystem是一个抽象化文件系统,它允许您轻松用远程文件系统换掉一个本地文件系统。

目标

  • 拥有一个通用的API来处理跨多个文件存储的常见任务
  • 拥有一致的输出
  • 与其他包/框架很好地集成。
  • 可缓存。
  • Emulate directories in systems that support none, like AwsS3.
  • Support third party plugins.
  • Make it easy to test your filesystem interactions.
  • Support streams for big file handling

spl_autoload_register(function($class) {      $prefix = 'League\\Flysystem\\';        if ( ! substr($class, 0, 17) === $prefix) {          return;      }        $class = substr($class, strlen($prefix));      $location = __DIR__ . 'path/to/flysystem/src/' . str_replace('\\', '/', $class) . '.php';        if (is_file($location)) {          require_once($location);      }  });

Adapters

  • Local
  • Amazon Web Services - S3
  • Rackspace Cloud Files
  • Dropbox
  • Copy
  • Ftp
  • Sftp (through phpseclib)
  • Zip (through ZipArchive)
  • WebDAV (through SabreDAV)
  • NullAdapter

Planned Adapters

  • Azure (PR welcome)
  • PR's welcome?

Caching

  • Memory (array caching)
  • Redis (through Predis)
  • Memcached
  • Adapter
  • Stash

项目主页:http://www.open-open.com/lib/view/home/1416897859230