PHP code example of as247 / flysystem-google-drive
1. Go to this page and download the library: Download as247/flysystem-google-drive library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
as247 / flysystem-google-drive example snippets
$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);