2017 © Pedro Peláez
 

library weather

get weather from openweathermap api

image

modulor/weather

get weather from openweathermap api

  • Tuesday, December 13, 2016
  • by modulor
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

OpenWeatherMap PHP Library

Basic API usage from openweathermap.org, (*1)

Installation

via Composer:, (*2)

Create or add the following to composer.json in your project root:, (*3)

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/modulor/weather"
        }
    ],
    "require": {
        "modulor/weather": "dev-master"
    }
}

run composer install, (*4)

Example

Get weather by city name, (*5)

require_once("path/to/vendor/autoload.php");

WeatherAPI\Configs::setApiKey('your_api_key');

$searchWeather = new WeatherAPI\Current\Search();

$searchWeather->setQueryParams(array(
  'q' => 'london'
));

print_r($searchWeather->execute());

Get weather by geographic coordinates, (*6)

require_once("path/to/vendor/autoload.php");

WeatherAPI\Configs::setApiKey('your_api_key');

$searchWeather = new WeatherAPI\Current\Search();

$searchWeather->setQueryParams(array(
  'lat' => '-22.0622478',
  'lon' => '-44.0444834'
));

print_r($searchWeather->execute());

The Versions

13/12 2016

dev-master

9999999-dev https://github.com/modulor/weather

get weather from openweathermap api

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Avatar modulor