la-haute-societe / yii2-flysystem-google-drive
Flysystem Google Drive 文件系统用于 Yii2
1.1.0
2023-02-17 13:52 UTC
Requires
- creocoder/yii2-flysystem: ^0.8.1
- nao-pon/flysystem-google-drive: ^1.1
- yiisoft/yii2: ^2.0.0
This package is auto-updated.
Last update: 2024-09-17 17:07:47 UTC
README
Flysystem Google Drive 文件系统用于 Yii2
安装
安装此扩展的首选方式是通过composer。
运行以下命令之一
composer require --prefer-dist la-haute-societe/yii2-flysystem-google-drive "^1.0.0"
或者将以下内容添加到您的composer.json
文件的require部分。
"la-haute-societe/yii2-flysystem-google-drive": "^1.0.0"
使用方法
此扩展是由 @creocoder 开发的 Yii2 Flysystem 扩展的 Google Drive 文件系统。
它使用了由 @nao-pon 开发的 Flysystem Adapter for Google Drive
有关使用说明,请参阅Yii2 Flysystem 文档
您可以在这里找到有关如何获取clientID、clientSecret和refreshToken的帮助(感谢@ivanvermeyen)
配置
本地文件系统
按照以下方式配置应用程序的 components
return [ //... 'components' => [ //... 'googleDrive' => [ 'class' => lhs\Yii2FlysystemGoogleDrive\GoogleDriveFilesystem::class, 'clientId' => 'xxx YOUR CLIENT ID xxx', 'clientSecret' => 'xxx YOUR CLIENT SECRET xxx', 'refreshToken' => 'xxx YOUR REFRESH TOKEN xxx', // 'driveId' => 'xxx YOUR TEAM DRIVE ID xxx', // 'rootFolderId' => 'xxx ROOT FOLDER ID xxx' ], ], ];
然后您可以像这样访问 flysystem API
$contents = Yii::$app->googleDrive->listContents(); ...