PHP code example of geekofcn / weather

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

    

geekofcn / weather example snippets


$response = $weather->getWeather('北京', 'all');

$response = $weather->getWeather('北京', 'all', 'xml');

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

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

public function edit() 
{
   $response = app('weather')->getWeather('北京');
}
shell
$response = $weather->getWeather('北京');