1. Go to this page and download the library: Download mhaggag/laravel-weather 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/ */
mhaggag / laravel-weather example snippets
use MHaggag\LaravelWeather\Facades\Weather;
public function index()
{
// Get current weather for Cairo (Lat: 30.0444, Lon: 31.2357)
$current = Weather::current(30.0444, 31.2357);
// With options (e.g., Arabic output)
$currentAr = Weather::current(30.0444, 31.2357, ['locale' => 'ar']);
return $current;
}