PHP code example of lhp9916 / weather

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

    

lhp9916 / weather example snippets


use Lhp9916\Weather\Weather;

$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';

$weather = new Weather($key);

$response = $weather->getWeather('深圳');

$response = $weather->getWeather('深圳', 'all');

array | string   getWeather(string $city, string $type = 'base', string $format = 'json')

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

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

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