sfWeatherPlugin - 1.0.4

Weather web service

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
This plugin is deprecated and is not maintained anymore. Weather.com api is not free now, fuck them !
Show source

sfWeather plugin

This plugin will get to you the weather information from Weather.com

At the first time, you have to register an account to weather.com XML Weather Services (In the account profile). Next you will recive an partner ID and an Licence Key (totaly free).

Licence key registration

  1. Create an account on weather.com website
  2. Go to your account setting an subscribe XML Date Feed
  3. You will recive a licence key by email

Registration Link : https://registration.weather.com/ursa/xmloap/step2

How to use

In app.yml

all:
  weather:
    partner: 1039925757         # Your weather.com partner ID
    licence: 709b14c526eae8ee   # Your weather.com licence key

In your action

$w = new sfWeather('SZXX0022'); // City code, in the example (Montreux, Switzerland)
$w->setUnit('c');               // "c" for celsius or "f" for Fahrenheit
$w->setForecast(2);             // The number of the days for the forecast
 
$this->weather_data = $w->retrieve();   // Retrive the data from weather.com

You can show the value with a simple print_r('weather_data')

Example

An example is included in the package

  • Enabled "sfweatherplugin" in "enabled_module" setting in your settings.yml
  • Just type http://localhost/main_dev.php/sfweatherplugin or http://localhost/main_dev.php/sfweatherplugin/small

weather plugin