PHP code example of lukundo / weather-client

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

    

lukundo / weather-client example snippets


$client = new WeatherClient('your_api_key');



use Lukundo\WeatherClient;

$client = new WeatherClient('your_api_key');
$weather = $client->getWeather('Ndola');
print_r($weather);

use Lukundo\WeatherClient;

public function showWeather()
{
    $client = new WeatherClient('your_api_key');
    $data['weather'] = $client->getWeather('Ndola');
    return view('weather_view', $data);
}

[
    'city' => 'Ndola',
    'temperature' => 23.5,
    'description' => 'clear sky',
    'humidity' => 60,
    'wind_speed' => 4.2
]