PHP code example of rakibdevs / covid19-laravel-api

1. Go to this page and download the library: Download rakibdevs/covid19-laravel-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rakibdevs / covid19-laravel-api example snippets


'providers' => [
    // ...
    RakibDevs\Covid19\Covid19ServiceProvider::class,
],
'aliases' => [
    //...
    'Covid19' => RakibDevs\Covid19\Covid19::class,	
];



	return [
	    'api_key' 	        => ''
	];

use RakibDevs\Covid19\Covid19;
use RakibDevs\Covid19\Facades\Covid;

// Get current Covid19 by city name 

// 1. The traditional way
$wt   = new Covid19();
$info = $wt->getCountries('ban');    

// 2. The Facade way
$info = Covid::getCountries('ban');




// By country name or portion of string
$info = $wt->getCountries('ban'); 

// Get all countries
$info = $wt->getAllCountries(); 


// By country name
$info = $wt->getStatistics(); 

// Get statistics
$info = $wt->getAllStatistics(); 


// By country name [tory('bangladesh', '2020-01-01'); 




$info = $wt->getSummary();


	$ php artisan vendor:publish

{
    "get":"statistics"
    "parameters":{
        "country":"bangladesh"
    }
    "errors":[]
    "results":1
    "response":[
        0:{
            "continent":"Asia"
            "country":"Bangladesh"
            "population":165545725
            "cases":{
            "new":"+692"
            "active":47562
            "critical":NULL
            "recovered":466064
            "1M_pop":"3149"
            "total":521382
        }
        "deaths":{
            "new":"+22"
            "1M_pop":"47"
            "total":7756
        }
        "tests":{
            "1M_pop":"20202"
            "total":3344399
        }
        "day":"2021-01-10"
        "time":"2021-01-10T05:30:06+00:00"
        }
    ]
}