as247 / flysystem-google-drive
Google Drive Adapter for Flysystem
Installs: 3 007
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- ext-json: *
- as247/cloud-storages: ^1.2.4
- google/apiclient: ^2.0
- league/flysystem: ^3.23
README
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 'google_drive_adapter_prefix'=>'[Path prefix]',//Path prefix inside root folder ]; $adapter = new \As247\Flysystem\GoogleDrive\GoogleDriveAdapter($service, $options); $filesystem = new \League\Flysystem\Filesystem($adapter);