<p>Looks like there are already several <a href="https://packagist.org/search/?q=forecast" rel="nofollow">PHP libraries</a> for the <a href="https://developer.forecast.io/docs/v2" rel="nofollow">forecast.io API</a>.</p>

<p>I'd probably spend a few minutes reviewing those and find one that's to your liking.  Then, it's a simple as writing a <a href="http://craftcms.com/docs/plugins" rel="nofollow">Craft plugin</a> that utilizes that library to make calls to their API and deal with the response as appropriate.</p>

CC BY-SA 3.0
2016-03-28T23:47:46.350Z
Thanks Brad! I kind of figure that might be the way to go. Time to finally read about creating plugins for Craft.
Tim Knight
CC BY-SA 3.0
2016-03-29T01:01:28.620Z
Brad, a quick follow up question if I may. Are you aware of a plugin that uses an existing PHP package as the foundation of the plugin that I could reference in terms of development?
Tim Knight
CC BY-SA 3.0
2016-03-29T01:20:01.260Z
You can use pluginfactory.io to generate the boilerplate Craft plugin code and read over something like this to see how to integrate a composer package into a Craft plugin: https://craftcms.stackexchange.com/questions/4859/plugin-dev-load-third-party-library/
Brad Bell
CC BY-SA 3.0
2016-03-28T22:17:45.367Z
2016-03-28T22:17:45.367Z
Brad Bell
<p>Does anyone have any experience with integrating the forecast.io API for  location data for a Craft CMS site? I haven't been able to find any direct plugins for Forecast.io, but I was investigating the <a href="https://dukt.net/craft/rest" rel="nofollow">REST plugin</a> as a possible option and I've also heard about <a href="https://github.com/engram-design/FeedMe" rel="nofollow">FeedMe</a> as well. Are there any preferred options as a best practice? My hope would be to be able to pull the data in and use it within a field of an existing entries page based on data on that entries page.</p>

<p>On a related note does wrapping Craft's caching tag around these plugin calls cache plugin output too? Probably a stupid question, just wanting to make sure I approach this solution correctly.</p>

<plugins><json>
Integrating and Caching Weather Data from Forecast.io API
# Integrating and Caching Weather Data from Forecast.io API

(Asked by: username_0 on 2016-03-28)

Does anyone have any experience with integrating the forecast.io API for location data for a Craft CMS site? I haven't been able to find any direct plugins for Forecast.io, but I was investigating the [REST plugin](https://dukt.net/craft/rest) as a possible option and I've also heard about [FeedMe](https://github.com/engram-design/FeedMe) as well. Are there any preferred options as a best practice? My hope would be to be able to pull the data in and use it within a field of an existing entries page based on data on that entries page.

On a related note does wrapping Craft's caching tag around these plugin calls cache plugin output too? Probably a stupid question, just wanting to make sure I approach this solution correctly.

**Tags:** plugins, json


---

## 1 answers

### Answer by username_1 on 2016-03-28. Score: 0 | Accepted answer

Looks like there are already several [PHP libraries](https://packagist.org/search/?q=forecast) for the [forecast.io API](https://developer.forecast.io/docs/v2).

I'd probably spend a few minutes reviewing those and find one that's to your liking. Then, it's a simple as writing a [Craft plugin](http://craftcms.com/docs/plugins) that utilizes that library to make calls to their API and deal with the response as appropriate.

> **Comments:**
> **username_0**: Thanks Brad! I kind of figure that might be the way to go. Time to finally read about creating plugins for Craft.  
> **username_0**: Brad, a quick follow up question if I may. Are you aware of a plugin that uses an existing PHP package as the foundation of the plugin that I could reference in terms of development?  
> **username_1**: You can use pluginfactory.io to generate the boilerplate Craft plugin code and read over something like this to see how to integrate a composer package into a Craft plugin: https://craftcms.stackexchange.com/questions/4859/plugin-dev-load-third-party-library/  

---

