PHP code example of php-weather / tomorrow

1. Go to this page and download the library: Download php-weather/tomorrow 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/ */

    

php-weather / tomorrow example snippets


$tomorrowKey = 'key';

$httpClient = new \Http\Adapter\Guzzle7\Client();
$tomorrowIo = new \PhpWeather\Provider\Tomorrow\Tomorrow($httpClient, $tomorrowKey);

$latitude = 47.873;
$longitude = 8.004;

$currentWeatherQuery = \PhpWeather\Common\WeatherQuery::create($latitude, $longitude);
$currentWeather = $tomorrowIo->getCurrentWeather($currentWeatherQuery);
shell
composer