o-ba/covid-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

o-ba/covid-php

Composer 安装命令:

composer require o-ba/covid-php

包简介

CovidPHP is a PHP API wrapper for the coronavirus tracking API

README 文档

README

CovidPHP is a PHP API wrapper for the Coronavirus tracker API.

Per default the data is provided by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE), but you can also use csbs as source.

Installation

You can install o-ba/covid-php using Composer:

composer require o-ba/covid-php

Require the composer autoloader in your script:

require 'vendor/autoload.php';

Usage

Create a instance of the API wrapper first:

$covidApi = new \Bo\CovidPHP\CovidApi();

Available methods

Methods Parameters Description
getSources() Get all available sources.
getLatest() string $source Get the latest data summarized.
getAllLocations() bool $includeTimelines (optional)
string $source (optional)
Get all available locations.
findByCountryCode() string $countryCode
bool $includeTimelines (optional)
string $source (optional)
Get country specific data based on the country code.
findByLocation() int $locationId
bool $includeTimelines (optional)
string $source (optional)
Get location specific data based on the location id.

Further information

  • Setting $includeTimelines adds timeline data to the response
  • Setting $source let's you specify which source the data should be fetched from (default: jhu)

Examples

Get all available sources:

$covidApi->getSources();

Get the latest global amount of total confirmed cases, deaths and recoveries:

$covidApi->getLatest();

Get all locations:

$covidApi->getAllLocations();

Get all locations including timelines:

$covidApi->getAllLocations(true);

Get location data by country code:

$covidApi->findByCountryCode('DE');

Get location data by country code from csbs as source:

$covidApi->findByCountryCode('US', false, 'csbs');

Get location data for a specific location:

$covidApi->findByLocation(11);

Note

  • All responses will be decoded and returned as array

License

MIT License

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固