phatnt93 / php_google_drive_sync
PHP Google Drive 同步
v1.0.0
2024-06-20 08:41 UTC
Requires
- php: >=8.0
- google/apiclient: ^2.15.0
This package is auto-updated.
Last update: 2024-09-20 09:13:16 UTC
README
同步文件夹中的文件。
要求
- Google 客户端 API 和 service_account.json 文件
- PHP >= 8.0
使用 composer 安装
composer require phatnt93/php_google_drive_sync
示例
查看示例
<?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);