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

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

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

private-it/flysystem-google-drive

最新稳定版本:1.4.0

Composer 安装命令:

composer require private-it/flysystem-google-drive

包简介

FlySystem adapter for Google Drive (work with path)

README 文档

README

FlySystem adapter for Google Drive (work with path)

This project is wrapper of nao-pon/flysystem-google-drive

Read more information this

Installation

composer require private-it/flysystem-google-drive:dev-master

Config

Config params:

[
    'clientId' => 'xxxxxxxxxxx.apps.googleusercontent.com',
    'clientSecret' => 'xxxxxxxxxxx',
    'refreshToken' => 'xxxxxxxxxxx',
    'folderId' => 'xxxxxxxxxxx',
    'sheetId' => 'xxxxxxxxxxx',
];

folderId - uses as root folder for upload/read.

sheetId - file id of "Google Sheets" document. Uses for save path-fileId. This document must be shared for public read.

Usage example

See examples/test.php

git clone https://github.com/private-it/flysystem-google-drive.git
composer install

Copy examples/config.example.php to examples/config.php

php examples/test.php

Usage with Laravel

Configuration google drive config/filesystems.php

    'disks' => [
...
        'googleDrive' => [
            'driver' => 'googleDrive',
            'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
            'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
            'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
            'folderId' => env('GOOGLE_DRIVE_FOLDER_ID'),
            'sheetId' => env('GOOGLE_DRIVE_PATH_MANAGER_SHEET_ID'),
        ],
...
    ],

[Laravel v4] Add ServiceProvider to config/app.php

'providers' => [
    ...
    PrivateIT\FlySystem\GoogleDrive\GoogleDriveServiceProvider::class
    ...
]

For custom PathManager you can set binding in file bootstrap/app.php

$app->bind(\PrivateIT\FlySystem\GoogleDrive\PathManager::class, \PrivateIT\FlySystem\GoogleDrive\GoogleSheetsPathManager::class);

Usage:

$disk = \Storage::disk('googleDrive');
$adapter = $disk->getDriver()->getAdapter();

$dir = 'test/sub1/sub2';
$fileName = 'test/sub1/sub2/new-file-1.txt';

var_dump($disk->makeDirectory($dir));
var_dump($disk->put($fileName, 'test content'));
var_dump($adapter->getUrl($fileName));
var_dump($disk->deleteDir($dir));

统计信息

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

GitHub 信息

  • Stars: 19
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-05