asharma327/apispreadsheets-php
Composer 安装命令:
composer require asharma327/apispreadsheets-php
包简介
Api Spreadsheets PHP Library
README 文档
README
PHP library for API Spreadsheets
Requirements
- PHP >= 7.0
Installation
composer require asharma327/apispreadsheets-php
Usage
1. Create
The create method will create new rows in the file.
The required parameters are:
fileId:stringThis id of the spreadsheet.data:arrayThe rows that you want to create.
require 'vendor/autoload.php'; use ApiSpreadsheets\Spreadsheet; // Data can have 3 formats: $data = [ 'Id' => 1, 'Name' => 'AT&T' ]; // Or: $data = [[ 'Id' => 1, 'Name' => 'AT&T' ], [ 'Id' => 2, 'Name' => 'Apple' ]]; // Or: $data = [ 'Id' => [1, 2], 'Name' => ['AT&T', 'Apple'] ]; $response = Spreadsheet::create('fileId', $data); // Or if the file is private you can provide API keys as extra parameters: $response = Spreadsheet::create('fileId', $data, 'accessKey', 'secretKey'); // ['message' => 'Your rows were created successfully', 'status_code' => 201]
2. Update
The update method will update values in columns.
The required parameters are:
fileId:stringThis id of the spreadsheet.data:arrayThe data you want to update.query:stringSQL style query to update the rows that you want.
require 'vendor/autoload.php'; use ApiSpreadsheets\Spreadsheet; $data = [ 'Id' => 1, 'Name' => 'AT&T' ]; $query = "select*from[fileId]whereId=1"; $response = Spreadsheet::update('fileId', $data, $query); // Or if the file is private you can provide API keys as extra parameters: $response = Spreadsheet::update('fileId', $data, $query, 'accessKey', 'secretKey'); // ['message' => 'Your rows were updated successfully', 'status_code' => 201]
3. Read
The read method will read rows from your file.
The required parameter is:
fileId:stringThis id of the spreadsheet.
require 'vendor/autoload.php'; use ApiSpreadsheets\Spreadsheet; // An optional array to filter or change how the returned rows look like $params = [ 'dataFormat' => 'column', // Can be matrix or column, the default is row. 'limit' => 10, // limit the returned rows 'count' => true, // only return the count of the result 'query' => "select*from{$file_id}whereId=1" // SQL style query to get a subset of rows. ]; $response = Spreadsheet::read('fileId', $params); // Or if the file is private you can provide API keys as extra parameters: $response = Spreadsheet::read('fileId', $params, 'accessKey', 'secretKey'); // Response: // in case of dataFormat is row (default): // ['data' => [['Id' => 1, 'Name' => 'Apple'], [...]], 'status_code' => 200] // column dataFormat: // ['Id' => [1, ...], 'Name' => ['Apple', ...], 'status_code' => 200] // matrix dataFormat: // ['data' => [[1, 'Apple'], [...]], 'status_code' => 200] // In case of count is true // ['count' => 10, 'status_code' => 200]
4. Delete
The delete method will delete rows from your file.
The required parameters are:
fileId:stringThis id of the spreadsheet.query:stringSQL style DELETE query to specify which rows to delete.
require 'vendor/autoload.php'; use ApiSpreadsheets\Spreadsheet; $query = "delete*from[fileID]whereId=1"; $response = Spreadsheet::delete('fileId', $query); // Or if the file is private you can provide API keys as extra parameters: $response = Spreadsheet::delete('fileId', $query, 'accessKey', 'secretKey'); // ['message' => '2 rows were deleted', 'status_code' => 200]
API Error Handling
If the API request has an error, an array with error and status_code key pairs will be returned, for example:
['error' = 'Error message', 'status_code' => 400]
For More information please consult the API docs: https://www.apispreadsheets.com/docs
License
The MIT License (MIT). Please see LICENSE for more information.
asharma327/apispreadsheets-php 适用场景与选型建议
asharma327/apispreadsheets-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 806 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「spreadsheets」 「api spreadsheets」 「apispreadsheets.com」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 asharma327/apispreadsheets-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 asharma327/apispreadsheets-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 asharma327/apispreadsheets-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Light, simple and standalone Google Spreadsheets Basic Connector
A PSR-7 compatible library for making CRUD API endpoints
This bundle manages Google Spreadsheets using the Google api.
Adds support for dynamic translations from Google Spreadsheets.
The Datapool PHP framework
Super simple Google Spreadsheets and Google Docs reader
统计信息
- 总下载量: 806
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-12