2017 © Pedro Peláez
 

library laravel-forecast

Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper

image

nwidart/laravel-forecast

Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper

  • Sunday, August 2, 2015
  • by nWidart
  • Repository
  • 1 Watchers
  • 2 Stars
  • 4,635 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Latest Version Software License SensioLabs Insight Quality Score Total Downloads, (*1)

Laravel 5 compatible package, (*2)

Laravel version Package version
~4.2 ~1.2
~5.1 ~2.1

Laravel-Forecast

Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper., (*3)

Want to use this as a standalone package ? Checkout the Forecast-php API wrapper., (*4)

Installation

``` bash $ composer require nwidart/laravel-forecast, (*5)


Add the service provider in `app/config/app.php` ```php 'providers' => [ ... Nwidart\LaravelForecast\LaravelForecastServiceProvider::class ]

Add the Alias provider in app/config/app.php, (*6)

'aliases' => [
    ...
    'Forecast' => Nwidart\LaravelForecast\ForecastFacade::class,
]

Publish the configuration file and add your forecast API key, (*7)

$ php artisan vendor:publish --provider="Nwidart\LaravelForecast\LaravelForecastServiceProvider"

Usage

Base usage

<?php

Forecast::get('37.8267','-122.423');

// Get the forecast at a given time
Forecast::get(('37.8267','-122.423', '2013-05-06T12:00:00-0400')

Setting global options for every request

In the settings you can add global options that will have used on every request made to Forecast.io. You can add this in the options key of the settings file., (*8)

For instance if you want temperature in Celsius:, (*9)

``` php 'options' => [ 'units' => 'si', ],, (*10)


For more details and all available options check the [official documentation](https://developer.forecast.io/docs/v2). ### Alternative method: dependency injection You can also inject the `Nwidart\ForecastPhp\Forecast` class into your constructor. ``` php /** * @var \Nwidart\ForecastPhp\Forecast */ private $forecast; public function __construct(\Nwidart\ForecastPhp\Forecast $forecast) { $this->forecast = $forecast; } public function doSomething() { $weather = $this->forecast->get($lat, $lon); }

License (MIT)

The Versions

02/08 2015

dev-master

9999999-dev

Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper

  Sources   Download

MIT

The Requires

 

laravel weather forecast

02/08 2015

2.1

2.1.0.0

Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper

  Sources   Download

MIT

The Requires

 

laravel weather forecast

01/08 2015

2.0

2.0.0.0

Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper

  Sources   Download

MIT

The Requires

 

laravel weather forecast

26/03 2015

1.2

1.2.0.0

Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper

  Sources   Download

MIT

The Requires

 

laravel weather forecast