抽象化的文件系統:Flysystem

jopen 11年前發布 | 21K 次閱讀 Flysystem

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.baiduhome.net/lib/view/home/1416897859230

     本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
     轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
     本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!