定制 zlt/php-google-drive 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zlt/php-google-drive

最新稳定版本:v0.2.2

Composer 安装命令:

composer require zlt/php-google-drive

包简介

Easy-To-Use PHP Library For Google Drive

README 文档

README

  • Installation

    $ composer require zlt/php-google-drive
  • Setup

    $clientId = 'clientId';
    $clientSecret = 'clientSecret';
    $refreshToken = 'refreshToken';
    $config = new GoogleDriveConfig(clientId: $clientId, clientSecret: $clientSecret, refreshToken: $refreshToken);
    $service = new GoogleDriveService($config);

If you don't know how to find the credentials i.e, clientId, clientSecret, refreshToken, read here.

  • Usage

  • Creating Content

    Use put method which accepts three parameters:

    • content - contents to be stored
    • fileName - filename of content to be stored
    • dir - If not specified, file will be stored under root. Otherwise, file will be stored under specifed dir.
    $service->put('This is example text', 'example.txt');
    
    $service->put('This is text will be stored under specified dir','example.txt','12sdf_sdfjopwoeriupsdf')
  • Getting File

    Use get method which accepts two parameters and return Google\Drive\DriveFile or GuzzleHttp\Psr7\Response

    • fileName - filename of content to be stored
    • params - If not specified, empty array is passed.
    $service->get('xxxxxxxxxxxxx');
    
    // or
    
    $service->get('xxxxxxxxxxxxx', [
      // pass parameters
    ])
  • Getting File Content

    Use getContent method which return GuzzleHttp\Psr7\Response.

    • fileName - filename of content to be stored
    $service->getContent('xxxxxxxxxxxxx');
  • Creating Dir

    Use makeDirectory which accepts two parameters:

    • folderName - folderName
    • dir - If not specified, folder will be created under root. Otherwise, folder will be created under specifed dir.
    $service->makeDirectory('New Folder');
      
    $service->makeDirectory('New Folder Under Specified Dir','12sdf_sdfjopwoeriupsdf')
  • Copy File

    Use copy which accepts three parameters:

    • fromId - fileId
    • fileName - fileName
    • dir - If not specified, folder will be created under root. Otherwise, folder will be created under specifed dir.
    $service->copy('1kojo32uoiuo123','new file.txt');
      
    $service->copy('1kojo32uoiuo123','new file.txt','12sdf_sdfjopwoeriupsdf')
  • List Contents

    Use listContents method which accepts two parameters: path which is either pathId, fileName, folderName ,and recursive which decide to show children contents.

      // List files inside root dir.
      $service->listContents()
    
      // List files inside 'shared with me' folder.
      $service->listContents(Zlt\PhpGoogleDrive\GoogleDriveService::SharedWithMe);
  • List Directories

    Use directories method which accepts two parameters: path which is either pathId, fileName, folderName

      // List files inside root dir.
      $service->directories()
    
      // List files inside 'shared with me' folder.
      $service->directories(Zlt\PhpGoogleDrive\GoogleDriveService::SharedWithMe);
  • List Files

    Use files method which accepts two parameters: path which is either pathId, fileName, folderName

      // List files inside root dir.
      $service->files()
    
      // List files inside 'shared with me' folder.
      $service->files(Zlt\PhpGoogleDrive\GoogleDriveService::SharedWithMe);
  • Delete File or Folder

    Delete file

    $service->delete('fileId')

统计信息

  • 总下载量: 308
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固