PHP code example of malvik-lab / weather-man
1. Go to this page and download the library: Download malvik-lab/weather-man 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/ */
malvik-lab / weather-man example snippets
alvikLab\WeatherMan\WeatherMan;
use MalvikLab\WeatherMan\Util\Constant;
use GuzzleHttp\Client;
$client = new Client();
$weatherMan = new WeatherMan($client);
## First, search location id
$locations = $weatherMan->searchLocation('Roma');
## Second, get data
/*
Available types:
- Constant::TODAY
- Constant::TOMORROW
- Constant::TWO_DAYS
- Constant::THREE_DAYS
- Constant::FOUR_DAYS
- Constant::FIVE_DAYS
- Constant::SIX_DAYS
- Constant::SEVEN_DAYS
*/
$locationId = '0058091';
$type = Constant::TODAY;
$data = $weatherMan->get($locationId, $type);