brookedot/weather-machine 问题修复 & 功能扩展

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

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

brookedot/weather-machine

最新稳定版本:v1.0.1

Composer 安装命令:

composer require brookedot/weather-machine

包简介

PHP wrapper for the Weather Machine API

README 文档

README

A PHP wrapper for the Weather Machine API.

Uses Sympfony HTTP Client.

Installation

composer require brookedot/weather-machine

Usage

use BrookeDot\WeatherMachine\WeatherMachine;

$weather = new WeatherMachine('your-api-key');

// Get hourly forecast
$hourly = $weather->location(47.608013, -122.335167)
    ->source('mock')
    ->units('si')
    ->hourly();

// Get current conditions
$current = $weather->location(47.608013, -122.335167)
    ->source('open_weather')
    ->currently();

// Get daily forecast
$daily = $weather->location(47.608013, -122.335167)
    ->source('open_weather')
    ->daily();

Available Methods

Required

  • location(float $lat, float $lon) - Set coordinates
  • source(string $source) - Set weather data source (defaults to 'mock')

Optional

  • units(string $unit) - Set units: us, si, ca, uk, m (default: us)
  • output(string $format) - Set output format: base, full (default: base)

Data Retrieval

  • get() - Get full response
  • currently() - Get current conditions
  • hourly() - Get hourly forecast
  • daily() - Get daily forecast
  • minutely() - Get minutely forecast
  • alerts() - Get weather alerts

Available Sources

  • accuweather
  • aeris_weather
  • apple_weather
  • custom_weather
  • foreca
  • mock
  • open_weather
  • pirate_weather
  • the_weather_company
  • tomorrow_io
  • visual_crossing
  • weatherbit

License

AGPL V3 or later License - see LICENSE file for details.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0
  • 更新时间: 2025-12-15