承接 diecoding/flysystem-google-drive 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

diecoding/flysystem-google-drive

最新稳定版本:1.1

Composer 安装命令:

composer require diecoding/flysystem-google-drive

包简介

Flysystem adapter for Google Drive

README 文档

README

Author Software License

Installation

  • For Google Drive API V3
composer require diecoding/flysystem-google-drive:~1.1

Usage

Follow Google Docs to obtain your ClientId, ClientSecret & refreshToken in addition you can also check this easy-to-follow tutorial

  • you can also check This Example for a better understanding.
$client = new \Google_Client(); $client->setClientId('[app client id].apps.googleusercontent.com'); $client->setClientSecret('[app client secret]'); $client->refreshToken('[your refresh token]'); $service = new \Google_Service_Drive($client); $adapter = new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter($service, '['root' or folder ID]'); /* Recommended cached adapter use */ // $adapter = new \League\Flysystem\Cached\CachedAdapter( // new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter($service, '['root' or folder ID]'), // new \League\Flysystem\Cached\Storage\Memory() // ); $filesystem = new \League\Flysystem\Filesystem($adapter);

Usage to with elFinder

composer require nao-pon/elfinder-flysystem-driver-ext composer require nao-pon/flysystem-google-drive:~1.1
// Load composer autoloader require 'vender/autoload.php'; // Google API Client $client = new \Google_Client(); $client->setClientId('xxxxx CLIENTID xxxxx'); $client->setClientSecret('xxxxx CLIENTSECRET xxxxx'); $client->refreshToken('xxxxx REFRESH TOKEN xxxxx'); // Google Drive Adapter $googleDrive = new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter( new \Google_Service_Drive($client), // Client service 'root', // Folder ID as root ('root' or Folder ID) [ 'useHasDir' => true ] // options (elFinder need hasDir method) ); // Extended cached strage adapter class for cache enabled of hasDir() method class myCachedStrageAdapter extends \League\Flysystem\Cached\Storage\Adapter { use \Hypweb\Flysystem\Cached\Extra\Hasdir; use \Hypweb\Flysystem\Cached\Extra\DisableEnsureParentDirectories; } // Make Flysystem adapter and cache object $useCache = true; if ($useCache) { // Example to Flysystem cacheing $cache = new myCachedStrageAdapter( new \League\Flysystem\Adapter\Local('flycache'), 'gdcache', 300 ); // Flysystem cached adapter $adapter = new \League\Flysystem\Cached\CachedAdapter( $googleDrive, $cache ); } else { // Not use cached adapter $cache = null; $adapter = $googleDrive; } // Google Drive elFinder Volume driver $gdrive = [ // require 'driver' => 'FlysystemExt', 'filesystem' => new \League\Flysystem\Filesystem($adapter), 'fscache' => $cache, 'separator' => '/', // optional 'alias' => 'GoogleDrive', 'rootCssClass' => 'elfinder-navbar-root-googledrive' ]; // elFinder volume roots options $elFinderOpts = [ 'roots' => [] ]; $elFinderOpts['roots'][] = $gdrive; // run elFinder $connector = new elFinderConnector(new elFinder($elFinderOpts)); $connector->run();

Tips

TODO

  • Unit tests to be written

统计信息

  • 总下载量: 2.86k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 129
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固