PHP code example of destcable / weather-php

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

    

destcable / weather-php example snippets


use WeatherPHP\Weather;

$weather = new Weather( apiKey: 'you_api_key');

$weather->language = 'ru';

$weather->find(
    city: 'San Francisco'
);

$weather->getTemperature();

use WeatherPHP\Weather;

$weather = new Weather( apiKey: 'you_api_key');

$weather->getDaysTemperature(
    city: 'Москва', 
    days: 5
);

use WeatherPHP\Weather;

$event = new Event( 
    name: 'Playing football with friends', 
    city: 'Moscow', 
    date: '2023-08-30 12:00', 
    expectedWeather: 'Sunny'
);