Laravel Weather by Henrik B Hansen allows you to fetch weather data from different weather providers in your Laravel projects. Here’s a quick example of what using this package looks like using the Facade:
// 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 getting a forecast. Here’s an example from the readme:
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);
Our API service for existing customers is not changing today, but we will no longer accept new signups. The API will continue to function through the end of 2021
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 installation instructions, and view the source code on GitHub at vemcogroup/laravel-weather.Filed in: News
Join 31,000+ others and never miss out on new tips, tutorials, and more.
Laravel 8.3 Released
The Laravel team released v8.3.0 this week with JSON casting for database test assertions, the ability to use closure…
Scout APM: Spend Less Time Troubleshooting, More Time Coding (sponsor)
Scout APM is PHP application performance monitoring designed to help developers quickly pinpoint and resolve performa…