PHP code example of php-weather / brightsky
1. Go to this page and download the library: Download php-weather/brightsky 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 / brightsky example snippets
$httpClient = new \Http\Adapter\Guzzle7\Client();
$brightSky = new \PhpWeather\Provider\Brightsky\Brightsky($httpClient);
$latitude = 47.873;
$longitude = 8.004;
$currentWeatherQuery = \PhpWeather\Common\WeatherQuery::create($latitude, $longitude);
$currentWeather = $brightSky->getCurrentWeather($currentWeatherQuery);
shell
composer