PHP code example of zhoubohan / weather

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

    

zhoubohan / weather example snippets


use Zhoubohan\Weather\Weather;

$key = 'xxxxxxxxxxxxxxxxxxxxxx';

$c = new Weather($key);

$res = $c->getLiveWeather('北京');

$res = $c->getForecastWeather('北京');

$res = $c->getLifestyleWeather('北京');

    .
    .
    .
     'weather' => [
        'key' => env('WEATHER_API_KEY'),
    ],

    .
    .
    .
    public function edit(Weather $weather) 
    {
        $response = $weather->getLiveWeather('深圳');
    }
    .
    .
    .

    .
    .
    .
    public function edit() 
    {
        $response = app('weather')->getLiveWeather('深圳');
    }
    .
    .
    .