11 months ago

Laravel Dark Sky (Weather Forecast)

Posted 11 months ago by dmitry.g.ivanov

Hey, guys!

I've created the package for getting the weather forecast (and past weather conditions) using the Dark Sky API.

The syntax is very simple:

use DarkSky;

$forecast = DarkSky::at($latitude, $longitude)->forecast();

You can get the forecast, or do the "time machine" requests for multiple dates:

$weather = DarkSky::at($latitude, $longitude)->timeMachine(['1986-05-11', '1987-05-11', '1988-05-11']);

Multiple requests are executed concurrently for you, so you don't have to bother with that. Also, the response body is automatically gzipped for better performance.

You can change the language, the units system and other parameters on the fly, or in your config file.

Please, check the readme file for more information:

Hope it would be useful for someone!

Please sign in or create an account to participate in this conversation.