nwidart/laravel-forecast 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nwidart/laravel-forecast

Composer 安装命令:

composer require nwidart/laravel-forecast

包简介

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

README 文档

README

Latest Version Software License SensioLabs Insight Quality Score Total Downloads

Laravel 5 compatible package

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.

Want to use this as a standalone package ? Checkout the Forecast-php API wrapper.

Installation

$ composer require nwidart/laravel-forecast

Add the service provider in app/config/app.php

'providers' => [
	...
	Nwidart\LaravelForecast\LaravelForecastServiceProvider::class
]

Add the Alias provider in app/config/app.php

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

Publish the configuration file and add your forecast API key

$ 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.

For instance if you want temperature in Celsius:

'options' => [
   'units' => 'si',
],

For more details and all available options check the official documentation.

Alternative method: dependency injection

You can also inject the Nwidart\ForecastPhp\Forecast class into your constructor.

 /**
 * @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)

统计信息

  • 总下载量: 4.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固