obrio-team/google-api-client
Composer 安装命令:
composer require obrio-team/google-api-client
包简介
PHP package to manage google-api interactions
README 文档
README
PHP package to manage google-api interactions
Supports:
- Google Drive API
- Google Spreadsheet API
Installation
composer require obrio-team/google-api-client
Config:
- Provide auth credential configs for native google-apiclient library
- Enable dependency injection. E.g. Symfony config.yaml
services: ObrioTeam\GoogleApiClient\: resource: '../vendor/obrio-team/google-api-client/src'
- If you would like to define your custom ItemStatusService` statuses inject delimiter and your custom status extensions. E.g. Symfony config.yaml
services: ObrioTeam\GoogleApiClient\Service\ItemStatus\GoogleItemStatusService: class: ObrioTeam\GoogleApiClient\Service\ItemStatus\GoogleItemStatusService arguments: - ':' #delimiter - [ '@App\Domain\Statuses\CustomStatusOne' #implementation ]
Google drive service
| Method | Arguments | Output | Description |
|---|---|---|---|
| getFile | string $fileId, array $optionalParam = [] | ?Google_Service_Drive_DriveFile | Get single Google drive file by its ID or null. |
| createFile | Google_Service_Drive_DriveFile $file, array $optionalParams = [] | ?Google_Service_Drive_DriveFile | Try to create file with locally created DriveFile object |
| updateFile | string $fileId, Google_Service_Drive_DriveFile $file, array $optionalParams = [] | ?Google_Service_Drive_DriveFile | Try to update file with locally created DriveFile object |
| getFilteredFileList | ?string $folderId = null, bool $deepPagination = false, ?GoogleItemRuleStrategyInterface ...$itemRuleStrategies | array | Get list of files. If set deepPagination=true all files through google pagination will be matched. Also you can perform filtering by various strategies |
| exportFileContent | string $fileId, string $mimeType = 'text/plain', array $optionalParams = [] | \GuzzleHttp\Psr7\Request | Get content of GoogleDoc file in desired format by file ID |
| getNonGoogleDocsFileContent | string $fileId | \GuzzleHttp\Psr7\Request | Get contents of non-GoogleDoc file by file ID |
| changeFileStatus | Google_Service_Drive_DriveFile $file, ContentStatusAbstract $targetStatus | ?Google_Service_Drive_DriveFile | Try to update file name with status using GoogleItemStatusService |
Google spreadsheet service
| Method | Arguments | Output | Description |
|---|---|---|---|
| getJustNewValues | string $spreadsheetId, string $range = '' | GoogleSheetValuesResponse | Get only updated values as DTO with key=>value array |
| getSheets | string $spreadsheetId | GoogleSheetSheetsResponse | Get DTO with list of spreadsheet sheets |
| getValues | string $spreadsheetId, ?string $sheetTitle = null, string $range = '' | GoogleSheetValuesResponse | Get sheet values as DTO with key=>value array. If no sheetTitle defined - getting values from first sheet in spreadsheet. Specific range can set. |
| updateField | string $spreadsheetId, UpdateFieldRequest $updateFieldRequest | Google_Service_Sheets_UpdateValuesResponse | Update single cell value |
| updateRange | string $spreadsheetId, UpdateRangeRequest $updateRangeRequest | Google_Service_Sheets_UpdateValuesResponse | Update range request in specified sheet. |
| addSpreadsheetPage | string $spreadsheetId, AddSpreadsheetPageRequest $addSpreadsheetPageRequest | Google_Service_Sheets_BatchUpdateSpreadsheetResponse | Add new sheet to the spreadsheet. |
| appendDimensionToSpreadsheetPage | string $spreadsheetId, AppendDimensionToSpreadsheetPageRequest $appendDimensionToSpreadsheetPageRequest | Google_Service_Sheets_BatchUpdateSpreadsheetResponse | Append colimns or rows to the specific sheet of the spreadsheet. |
| createGoogleSpreadsheet | string $name, ?string $parentFolderId = null | Google_Service_Sheets_Spreadsheet | Create new spreadsheet file in defined parent folder. |
| appendRows | string $spreadsheetId, AppendRowsRequest $appendRowsRequest | Google_Service_Sheets_AppendValuesResponse | Append one or more rows to the end of table on spreadsheet. |
Hints
To get all mentioned ...Request DTOs use this factories:
\ObrioTeam\GoogleApiClient\Factory\GoogleDriveFileFactory::class; \ObrioTeam\GoogleApiClient\Factory\GoogleSpreadsheetRequestFactory::class;
obrio-team/google-api-client 适用场景与选型建议
obrio-team/google-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 675 次下载、GitHub Stars 达 5, 最近一次更新时间为 2021 年 05 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 obrio-team/google-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 obrio-team/google-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 675
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-12