nyeholt/silverstripe-weatherforecast

Retrieve a weather forecast (uses openweather)

Installs: 3 969

Dependents: 0

Suggesters: 0

Stars: 0

Watchers: 1

Forks: 3

Open Issues: 0

Language:HTML

Type:silverstripe-module

dev-master / 1.0.x-dev 2016-07-20 07:19 UTC

README

Usage

In your project .yml config

---
Name: weather-config
After: weatherforecast/*
---
Injector:
  OpenWeatherService:
    properties:
      key: {your key here}

From your code, call the following. The LocationID will need to be looked up from the openweather site.

Requirements::css('weatherforecast/owfonts/css/owfont-regular.min.css');
$forecast = singleton('OpenWeatherService')->forecastFor($locationID);

PLEASE NOTE

The requirements of OpenWeatherMaps mean you must provide attribution on your site for using the service.