dev-master
9999999-devFlySystem adapter for Google Drive (work with path)
MIT
The Requires
by Igor Sapegin
laravel flysystem google drive
Wallogit.com
2017 © Pedro Peláez
FlySystem adapter for Google Drive (work with path)
FlySystem adapter for Google Drive (work with path), (*1)
This project is wrapper of nao-pon/flysystem-google-drive, (*2)
Read more information this, (*3)
composer require private-it/flysystem-google-drive:dev-master
Config params:, (*4)
[
'clientId' => 'xxxxxxxxxxx.apps.googleusercontent.com',
'clientSecret' => 'xxxxxxxxxxx',
'refreshToken' => 'xxxxxxxxxxx',
'folderId' => 'xxxxxxxxxxx',
'sheetId' => 'xxxxxxxxxxx',
];
folderId - uses as root folder for upload/read., (*5)
sheetId - file id of "Google Sheets" document. Uses for save path-fileId. This document must be shared for public read., (*6)
See examples/test.php, (*7)
git clone https://github.com/private-it/flysystem-google-drive.git composer install
Copy examples/config.example.php to examples/config.php, (*8)
php examples/test.php
Configuration google drive config/filesystems.php, (*9)
'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, (*10)
'providers' => [
...
PrivateIT\FlySystem\GoogleDrive\GoogleDriveServiceProvider::class
...
]
For custom PathManager you can set binding in file bootstrap/app.php, (*11)
$app->bind(\PrivateIT\FlySystem\GoogleDrive\PathManager::class, \PrivateIT\FlySystem\GoogleDrive\GoogleSheetsPathManager::class);
Usage:, (*12)
$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));
FlySystem adapter for Google Drive (work with path)
MIT
laravel flysystem google drive