PHP code example of nwidart / laravel-forecast

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

    

nwidart / laravel-forecast example snippets


'providers' => [
	...
	Nwidart\LaravelForecast\LaravelForecastServiceProvider::class
]

'aliases' => [
	...
	'Forecast' => Nwidart\LaravelForecast\ForecastFacade::class,
]



Forecast::get('37.8267','-122.423');

// Get the forecast at a given time
Forecast::get(('37.8267','-122.423', '2013-05-06T12:00:00-0400')

$ php artisan vendor:publish --provider="Nwidart\LaravelForecast\LaravelForecastServiceProvider"
 php
'options' => [
    'units' => 'si',
],
 php

 /**
 * @var \Nwidart\ForecastPhp\Forecast
 */
private $forecast;

public function __construct(\Nwidart\ForecastPhp\Forecast $forecast)
{
    $this->forecast = $forecast;
}

public function doSomething()
{
    $weather = $this->forecast->get($lat, $lon);
}