as247/flysystem-google-drive

Google Drive Adapter for Flysystem

v3.0.1 2024-02-04 15:31 UTC

This package is auto-updated.

Last update: 2024-04-30 11:01:34 UTC


README

Author Software License

Installation

composer require as247/flysystem-google-drive

Usage

Follow Google Docs to obtain your ClientId, ClientSecret & refreshToken

In addition, you can also check these easy-to-follow tutorial by @ivanvermeyen

$client = new \Google_Client();
$client->setClientId('[app client id].apps.googleusercontent.com');
$client->setClientSecret('[app client secret]');
$client->fetchAccessTokenWithRefreshToken('[your refresh token]');

$service = new \Google_Service_Drive($client);

$options=[
    'root'=>'[Root folder id]',
    'teamDrive'=>'[Team drive id]'//If your root folder inside team drive
    'prefix'=>'[Path prefix]',//Path prefix inside root folder
];

$adapter = new \As247\Flysystem\GoogleDrive\GoogleDriveAdapter($service, $options);

$filesystem = new \League\Flysystem\Filesystem($adapter);