Download the PHP package coliving/laravel-owm without Composer
On this page you can find all versions of the php package coliving/laravel-owm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download coliving/laravel-owm
More information about coliving/laravel-owm
Files in coliving/laravel-owm
Package laravel-owm
Short Description Wrapper for cmfcmf/openweathermap-php-api. This package fork from gmopx/laravel-owm as it's abandoned
License MIT
Informations about the package laravel-owm
Laravel-OWM (Open Weather Map)
A wrapper for OpenWeatherMap-PHP-Api writen by @cmfcmf
This package allows you to implement OpenWeatherMap-PHP-Api in laravel-way in your Laravel project.
1. Installation
composer require coliving/laravel-owm
2. Add this line to your conf/app.php file
For Laravel == 5.0.*
For Laravel <= 5.4.*
For Laravel >= 5.5.* will use the auto-discovery function.
3. Publish the config file (config/laravel-owm.php)
php artisan vendor:publish --provider="Gmopx\LaravelOWM\LaravelOWMServiceProvider"
4. Add your Open Weather Map API key
How to use...
Current weather
Visit https://github.com/cmfcmf/OpenWeatherMap-PHP-Api/blob/master/Examples/CurrentWeather.php for more info.
Forecast
Visit https://github.com/cmfcmf/OpenWeatherMap-PHP-Api/blob/master/Examples/WeatherForecast.php for more info.
History
Visit https://github.com/cmfcmf/OpenWeatherMap-PHP-Api/blob/master/Examples/WeatherForecast.php for more info.
Parameters:
Note:
getCurrentWeather:
getWeatherForecast:
getDailyWeatherForecast:
getWeatherHistory:
Routes
Additionally this package includes 2 routes ready-to-use that shows weather data in JSON format.
[GET]
/current-weather
Parameters:
[GET]
/forecast
Parameters:
Note: You must use city
or coord
but not both.
/current-weather
Consider the following:
- The timezone for the dates of the results is taken from the
app/config.php
file ('app.timezone').
/forecast (5 days)
Consider the following:
- The timezone for the dates of the results is taken from the
app/config.php
file ('app.timezone'). - The indexes of the days array, are ISO-8601 numeric representation of the day of the week, 1 (for Monday) through 7 (for Sunday).
- The OWM API returns 3 hour forecast data, it means for each day you requested you'll get weather data each 3 hours in this order: 06:00 - 09:00, 09:00 - 12:00, 12:00 - 15:00, 15:00 - 18:00, 18:00 - 21:00, 21:00 - 00:00. So to maintain a well-ordered info I built a key depending on the hours range (ie: ['06-09'] : { ... }).
Changelog
v0.1.2
- Support for getDailyWeatherForecast
v0.1.1
- Whitespace/formatting.
- Added getWeatherHistory method
- Additional README documentation
Thanks to:
License: MIT
Contributing
You can help me fixing my horrific English in the documentation & comments.