g3n1us / datatidy
从Google Sheets或其他来源获取数据,并返回标准化、结构化、整洁的数据
1.0.3
2017-08-20 01:24 UTC
Requires
- php: ^5.5.0 || ^7.0
- illuminate/http: ^5.3
- michelf/php-markdown: ^1.6
This package is auto-updated.
Last update: 2024-09-17 12:26:01 UTC
README
从Google Sheets和其他来源获取数据,并返回标准化、结构化、整洁的数据
用法
选项
$defaultoptions = [ 'allow_origin' => null, // If a response is to be generated, this value will be applied to an Access-Control-Allow-Origin header 'resultsas' => 'collection', // or paginate or array 'sort' => false, // key by which to sort 'ascending' => false, // applies to the sort order 'nomd' => false, // my default, content will be converted to HTML with Markdown, this option disables this 'paginate' => false, 'show_pagination' => true, 'results_per_page' => 12, ];
参数
URI或路径以检索数据。
要检索Google Sheets工作表,请使用以下格式: gproxy://<spreadsheet-key>
注意:工作表必须公开发布!
对于其他JSON格式的URI,指定一个相对或绝对端点以检索
选项:如上所示,一个选项数组
通过静态方法调用
DataTidy::response("gproxy://1R4ZW6fw7EggY6AsmBtVGWdjny-UYDgv3au6_VarHBMk", ['allow_origin' => '*']); // Returns a full Response DataTidy::get("gproxy://1R4ZW6fw7EggY6AsmBtVGWdjny-UYDgv3au6_VarHBMk"); // Returns the data as an instance of Illuminate\Collection
通过构造函数调用
use G3n1us\DataTidy; $datatidy = new Datatidy("gproxy://1R4ZW6fw7EggY6AsmBtVGWdjny-UYDgv3au6_VarHBMk"); $datatidy->get(); // or $datatidy->response();