My Blog Posts

Laravel Weather Package

Laravel Weather Package


The Laravel Weather Package, prepared by Henrik B Hansen, allows you to retrieve weather data from different weather providers in your Laravel projects. Here's how to use facade this package as follows:

Weather response will always be a Collection of responses.
Forecast days depends on the weather service provider.
$weather = weather()->getForecast($request);
Current weather
$weather->first()->getCurrently();

You can customize the request when receiving estimates. Example:

use Vemcogroup\Weather\Providers\Provider;
use Vemcogroup\Weather\Request as WeatherRequest;
$request = new WeatherRequest('1 Infinite Loop, Cupertino, CA 95014, USA');
$request->withUnits(Provider::WEATHER_UNITS_FAHRENHEIT);

Emerging from the package, Laravel Weather supports Dark Sky and Wetaherstack apis.

You can define your own provider to work with this package using the provided abstract class.

You can learn more about this package, get full setup instructions, and view the source code at GitHub at vemcogroup/laravel-weather.



Share this article


Comments (0)

Comment