chaoswd/weather 问题修复 & 功能扩展

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

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

chaoswd/weather

最新稳定版本:1.1.2

Composer 安装命令:

composer require chaoswd/weather

包简介

A lightweight PHP library for interacting with the National Weather Service (weather.gov) API. Provides alerts, daily forecasts, and hourly forecasts using a simple OOP interface.

README 文档

README

A lightweight PHP library for interacting with the National Weather Service (weather.gov) API.
Provides alerts, daily forecasts, and hourly forecasts using a simple OOP interface.

Installation

composer require chaoswd/weather

Usage

use Chaoswd\Weather\Weather;

$weather = new Weather(
    userAgent: 'YourAppName (your-email@example.com)',
    lat: '47.6062',
    long: '-122.3321'
);

// Get alerts
$weather->getAlerts();
print_r($weather->alerts);

// Get daily forecast
$weather->getDailyForecast();
print_r($weather->daily);

// Get hourly forecast
$weather->getHourlyForecast();
print_r($weather->hourly);

// OR Chain methods
$weather->getAlerts()->getDailyForecast()->getHourlyForecast();
print_r($weather->daily);

Finding Your Latitude & Longitude

Use this tool (or any you prefer) to convert a U.S. ZIP code into latitude and longitude:
https://www.freemaptools.com/convert-us-zip-code-to-lat-lng.htm

API Notes

Features

  • Fetch active weather alerts
  • Fetch full daily forecast
  • Fetch hourly forecast
  • Auto‑builds required forecast URLs using /points/{lat},{long} endpoint
  • Clean, chainable OOP interface

Requirements

  • PHP 8.3+
  • Composer
  • CURL

License

Licensed under the MIT license. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-24