Skip to content
/ covid-php Public

CovidPHP is a PHP API wrapper for the coronavirus tracking API

License

Notifications You must be signed in to change notification settings

o-ba/covid-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CovidPHP

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();

Examples

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

  • Setting $includeTimelines adds timeline data to the response
  • Setting $source let's you specify which source the data should be fetched from (default: jhu)
  • The mentioned parameters are available for all methods except CovidApi::getLatest()
  • All responses will be decoded and returned as array

License

MIT License

About

CovidPHP is a PHP API wrapper for the coronavirus tracking API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages