Giter Club home page Giter Club logo

forecast's Introduction

MyWeather Forecast

MyWeather Forecast was created by, and is maintained by Tyler Youschak. MyWeather Forecast uses Forecast.io's weather API, so a free API key will be required. I've chosen Forecast.io due to the really inexpensive API, which supplies you with 1,000 free calls per day. If you go over 1,000 calls, it's only one-cent per 10,000 calls.

Requirements

Before installing Forecast, you need to make sure you have cURL installed on your server! Chances are this will already be completed!

Installation

To get the latest version of MyWeather Forecast, simply add the following line to the require block of your composer.json file:

"myweather/forecast": "~1.0@dev"

You'll then need to run composer install or composer update to download it and have the autoloader updated.

If you're using Laravel 5, then you can register our service provider. Open up config/app.php and add the following to the providers array.

  • 'MyWeather\ForecastServiceProvider'

Usage

Usage of MyWeather Forecast is quite simple. To get started, you must first use our package. This will allow you to start using our package, here's an example: use MyWeather\ForecastClient;

Alright! We are now using the package, but how and where are we going to declare our API key (provided by Forecast.io)? Well, let's take a look:

  • You can use it by typing the following: $client = ForecastClient($apiKey); This will go ahead and set your API key for your request.
  • Now your going to want to set the latitude (lat) and longitude (lng) of the location your trying to find. It may be best to use Javascript and ask the person if you can use their location, or you can just hard code in a geo-location look up. Here's how you can do that: $forecast = $client->get('lat','lng');
  • Now, let's get the viddles! You can now (since you have declared your API key and lat & lng), use our currently, minutely, hourly, and daily selectors which will return that information in an array.

Here's a look at all of that combined:

use MyWeather\ForecastClient;

$client = new ForecastClient($apiKey);
$forecast = $client->get('lat','lng');
$currently = $forecast->currently();

Contribute

Have an idea of a new data selector that should be added? Or do you have an idea that will make this package even better? Open an issue report, and we'll have a gander!

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.