use Google\Client;
use Google\Service\Drive;
use JeffersonGoncalves\FlysystemGoogleDrive\GoogleDriveAdapter;
use League\Flysystem\Filesystem;
// Either build the adapter directly from credentials...
$adapter = GoogleDriveAdapter::fromCredentials(
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
refreshToken: 'your-refresh-token',
folder: 'Backups', // optional
);
// ...or hand it an already-configured \Google\Service\Drive (e.g. to inject a mock in tests).
$client = new Client();
$client->setClientId('your-client-id');
$client->setClientSecret('your-client-secret');
GoogleDriveAdapter::useRefreshTokenLazily($client, 'your-refresh-token');
$adapter = new GoogleDriveAdapter(new Drive($client), folder: 'Backups');
$filesystem = new Filesystem($adapter);
$filesystem->write('backups/db.sql.gz', $contents);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.