311archive / http-client
311.report API的PHP客户端。
0.1.0
2020-08-04 03:23 UTC
Requires
- php: ^7.4
- ext-json: *
- guzzlehttp/guzzle: ^6.3
- league/csv: ^9.6
- squizlabs/php_codesniffer: ^3.5
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-08-29 05:37:04 UTC
README
PHP客户端,用于从Boston 311 Archive API获取和处理波士顿311报告。
示例用法
请查看example-scripts
文件夹中的示例。
创建过去几年每天有关烟花311报告数量的CSV文件。
- 克隆此存储库或将它包含在你的PHP项目中。
- 实例化一个新的客户端
// Instantiate a new Client.
$client = new Balsama\Client();
// Find all Reports that contain the word "fireworks" or a common alternative spelling "fire works" in the description.
$client->filterDescription(['fireworks', 'fire works']);
// Group the results by day
$client->groupResultsByDay();
// Fetch the reports and store them in `$reports`.
$client->fetchReports();
$reports = $client->getReports();
// Format the number of reports per day into a simple `date` and `count` csv suitible for graphing.
\Balsama\Helpers::convertDateValArrayToCsv($reports, 'fireworks.csv');
文档
类 Client
公共方法
类 Helpers
方法(Helpers类中的所有方法都是静态的)
关于
Boston 311 Archive 是一个志愿者项目,旨在创建一个可搜索的波士顿311报告档案。有关更多信息,请参阅Boston 311 Archive: 关于。
Boston 311 Archive 还提供了一个符合JSON:API标准的易于发现的只读API。您可以直接在https://311.report/jsonapi中浏览API。