phatnt93/php_google_drive_sync

PHP Google Drive Sync

v1.0.0 2024-06-20 08:41 UTC

This package is auto-updated.

Last update: 2025-04-20 10:21:46 UTC


README

Sync files in folder.

Requirement

  1. Google Client API and service_account.json file
  2. PHP >= 8.0

Install with composer

composer require phatnt93/php_google_drive_sync

Example

See example:

<?php

use PhpGoogleDriveSync\Sync;

define('BASE_PATH', __DIR__);

require BASE_PATH . '/../vendor/autoload.php';

$folderId = '1UlcKImBa8-yGQQNalHeQlx5N9DJ523nM';
$sync = new Sync([
    'credential_account' => BASE_PATH . '/service_account.json'
]);
$sync->initGoogleClient();
if ($sync->hasError()) {
    throw new \Exception($sync->getError());
}
$sync->syncFolder(BASE_PATH . '/folder1', $folderId);