patriceckhart / google-drive-api

该软件包的最新版本(1.0.0)没有可用的许可信息。

Google Drive Api 客户端

1.0.0 2022-06-08 09:55 UTC

This package is not auto-updated.

Last update: 2024-09-26 20:05:40 UTC


README

Google Drive Api 客户端

安装

Google Drive Api 客户端已在包管理器上列出(https://packagist.org.cn/packages/patriceckhart/google-drive-api),因此您不再需要将包包含在“仓库”条目中。

只需运行

composer require patriceckhart/google-drive-api

用法

<?php

use PatricEckhart\GoogleDriveClient;

class GoogleDrive
{

    /**
     * List files
     *
     * @return array
     */
    public function listFiles():array
    {
        $client = new GoogleDriveClient(
            '/data/neos/Data/Security/google/client_secret_768913446618-aax0u2k92nh350lij57ts58a0igm1a82.apps.googleusercontent.com.json', // clientIdPathAndFileName
            'https://redirecturi.com', // redirectUri
            '2//13pMQO5SH5KXaCgYIARAAAERSNwF-L9IrXHD7F1SLRD0r2xJ8PicU!2dCtoZxmdb6dGCzl5UQVCFArqstTaIoUuTW7MjnEAzyPIg', // refreshToken
            'https://www.googleapis.com/auth/drive', // scope
            '1K__pKH52TK3ZxeWSR8O-XOgYad31_xtt', // startingPoint (Folder ID)
            20 // pageSize
        );
        return $client->list();
    }

}

响应

响应返回从起始点开始的完整文件夹和文件结构。

string "id" => string
string "name" => string
string "mimeType" => string
string "kind" => string
string "parent" => string
string "webViewLink" => string
string "webContentLink" => string
string "publicFile"  => string

作者