PHP code example of nwidart / forecast-php
1. Go to this page and download the library: Download nwidart/forecast-php 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/ */
nwidart / forecast-php example snippets
bash
$ composer
php
$forecast = new \Nwidart\ForecastPhp\Forecast('your_api_key');
// Simple latitude and longitude
$info = $forecast->get('40.7324296', '-73.9977264');
// Fetch weather at a given time
$info = $forecastPhp->get('40.7324296', '-73.9977264', '2013-05-06T12:00:00-0400');
// Add options to the request
$info = $forecastPhp->setOptions(['units' => 'si',])->get('40.7324296', '-73.9977264');