Giter Site home page Giter Site logo

oldjbyahooweatherapibundle's Introduction

JbYahooWeatherApiBundle

Latest Stable Version Total Downloads Latest Unstable Version License

Versions

  • 0.6.1 <--Current
  • 0.6
  • 0.5.2
  • 0.5.1
  • 0.5.0

Using and Setting Up

Add in AppKernel.php

public function registerBundles() {
  $bundles = array(
    new Jb\YahooWeatherApiBundle\JbYahooWeatherApiBundle(),
    new Lsw\MemcacheBundle\LswMemcacheBundle()
  );
}

Use

$this->get('jb.yahoo_weather_api');

Setting in config.yml

Two paramerters are available

jb_yahoo_weather_api:
    city_woeid: <woeid>
    unit: (optional by default f) - f for fahreneit or c for celsius 

The woeid is a code which correponds to your city : choose one of these tools -> https://www.google.fr/search?q=weid+find&oq=weid+find&aqs=chrome..69i57.2639j0j7&sourceid=chrome&es_sm=122&ie=UTF-8#q=woeid&safe=off

Activate memcached

config.yml

lsw_memcache:
    clients:
        jb_yahoo_weather_api:
            hosts:
              - { dsn: localhost, port: 11211 }
            options:
                prefix_key: "jbywa_"

And just have a look on debugbar to see if you have hits or write to memcached. Currently TTL is fixed on 600 seconds

Methods

   /**
   * Run query to Yahoo Weather Api with parameter given in Symfony2 config
   *  
   * @param string|null $woeid Woeid of the city to force query on specific city
   *
   * @return YahooWeatherApi Current object
   */
   public function query($woeid=null);
   
   /**
   * Get raw xml from Query done to Yahoo weather Api
   *
   * @return SimpleXMLElement Yahoo Weather Api Response
   */
   public function getXml();
   
   /**
   * Get Current condition datas : Attributes of node yweather:condition of xml
   * @see https://developer.yahoo.com/weather/#item
   * 
   * @return array All attributes of yweather:condition node
   */
   public function getCurrentCondition();
		
   /**
   * Get 5 days forecasts datas : Attributes of all nodes yweather:forecast of xml
   * @see https://developer.yahoo.com/weather/#item
   * 
   * @return array All attributes of yweather:forecast nodes
   */
   public function getForecast();

   /**
   * Get location datas : Attributes of node yweather:location of xml
   * @see https://developer.yahoo.com/weather/#channel
   * 
   * @return array All attributes of yweather:location node
   */
   public function getLocation();

   /**
   * Return temperature data
   * 
   * @return string temperature
   */
   public function temp();
		
   /**
   * Return city data
   * 
   * @return string city
   */
   public function city();
	

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.