PHP code example of rich2k / laravel-weatherkit

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

    

rich2k / laravel-weatherkit example snippets


'providers' => [
    Rich2k\LaravelWeatherKit\Providers\LaravelServiceProvider::class,
]

'aliases' => [
    'WeatherKit' => Rich2k\LaravelWeatherKit\Facades\WeatherKit::class,
]

WeatherKit::location(lat, lon)->dataSets(['currentWeather', 'forecastDaily'])->weather();

// OR

$weather = new \Rich2k\LaravelWeatherKit\WeatherKit();
$weather->location(lat, lon)->availability();
$weather->location(lat, lon)->weather();

->currently()
->hourly()
->daily()
->nextHour()

WeatherKit::location(lat, lon)->hourly()
WeatherKit::location(lat, lon)->dataSets(['forecastHourly'])->weather()->get('forecastHourly')
bash
$ php artisan vendor:publish --provider=\Rich2k\LaravelWeatherKit\Providers\LaravelServiceProvider
 php
WeatherKit::location(lat, lon)->weather();
 php
WeatherKit::lang('en_GB')->location(lat, lon)->weather();
 php
WeatherKit::location(lat, lon)->currentAsOf(now())->weather();
 php
WeatherKit::location(lat, lon)->dailyStart(now()->subDays(7))->dailyEnd(now())->weather();
 php
WeatherKit::location(lat, lon)->hourlyStart(now()->subHours(24))->hourlyEnd(now())->weather();
 php
WeatherKit::location(lat, lon)->timezone('Americas/Los_Angeles')->weather();