astrodog/laravel-weather 问题修复 & 功能扩展

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

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

astrodog/laravel-weather

Composer 安装命令:

composer require astrodog/laravel-weather

包简介

Package for get the weather data

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Open Meteo

Download Meteorological Data from OPEN-METEO API (https://open-meteo.com/en)

Open-Meteo collaborates with National Weather Services providing Open Data with 11 to 2 km resolution. Our high performance APIs select the best weather model for your location and provide data as a simple JSON API.

APIs are free without any API key for open-source developers and non-commercial use. You can embed them directly into your app.

Installation

You can install the package via composer:

composer require michaelnabil230/laravel-weather

You can publish the config file with:

php artisan vendor:publish --tag="laravel-weather-config"

This is the contents of the published config file:

return [
    'temperature_unit' => 'celsius',
    'wind_speed_unit' => 'kmh',
    'precipitation_unit' => 'mm',
    'time_format' => 'iso8601',
    'timezone' => 'GMT',
];

Usage

$weather = \MichaelNabil230\Weather\Weather::location(30.0812558, 31.2511902)
    ->current()
    ->get();

Functions:

Parameter Format Required Default
currentWeather Bool No false
temperatureUnit String No celsius
windSpeedUnit String No kmh
precipitationUnit String No kmh
timeFormat String No iso8601
timezone String No UTC
pastDays Integer (0-2) No 0

15-minutely Functions:

Variable Valid time Unit
temperature_2m_15min Instant °C (°F)
relativeHumidity_2m_15min Instant %
dewPoint_2m_15min Instant °C (°F)
apparentTemperature_15min Instant °C (°F)
windSpeed_10m_15min Instant km/h (mph, m/s, knots)
windSpeed_80m_15min Instant km/h (mph, m/s, knots)
windDirection_10m_15min Instant °
windDirection_80m_15min Instant °
windGusts_10m_15min Preceding 15 minutes max km/h (mph, m/s)
shortwaveRadiation_15min Preceding 15 minutes mean W/m²
directRadiation_15min Preceding 15 minutes mean W/m²
directNormalIrradiance_15min Preceding 15 minutes mean W/m²
diffuseRadiation_15min Preceding 15 minutes mean W/mv²
globalTiltedIrradiance_15min Preceding 15 minutes mean W/mv²
sunshineDuration_15Min Preceding 15 minutes sum Seconds
precipitation_15min Preceding 15 minutes sum mm (inch)
snowfall_15min Preceding 15 minutes sum cm (inch)
rain_15min Preceding 15 minutes sum mm (inch)
cape_15min Instant J/kg
visibility_15min Instant meters
weatherCode_15min Instant WMO code

Hourly Functions:

Variable Valid time Unit
temperature_2m Instant °C (°F)
relativeHumidity_2m Instant %
dewPoint_2m Instant °C (°F)
apparentTemperature Instant °C (°F)
pressureMsl Instant hPa
cloudCover Instant %
cloudCoverLow Instant %
cloudCoverMid Instant %
cloudCoverHigh Instant %
windSpeed_10m Instant km/h (mph, m/s, knots)
windSpeed_80m Instant km/h (mph, m/s, knots)
windSpeed_120m Instant km/h (mph, m/s, knots)
windSpeed_180m Instant km/h (mph, m/s, knots)
windDirection_10m Instant °
windDirection_80m Instant °
windDirection_120m Instant °
windDirection_180m Instant °
windGusts_10m Preceding hour max km/h (mph, m/s)
shortwaveRadiation Preceding hour mean W/m²
directRadiation Preceding hour mean W/m²
diffuseRadiation Preceding hour mean W/mv²
vaporPressureDeficit Instant kPa
evapotranspiration Preceding hour sum mm (inch)
precipitation Preceding hour sum mm (inch)
precipitationProbability Preceding hour probability %
hourlyWeatherCode Instant WMO code
snowHeight Instant meters
freezingLevelHeight Instant meters
soilTemperature_0cm Instant °C (°F)
soilTemperature_6cm Instant °C (°F)
soilTemperature_18cm Instant °C (°F)
soilTemperature_54cm Instant °C (°F)
soilMoisture_0_1cm Instant m³/m³
soilMoisture_1_3cm Instant m³/m³
soilMoisture_3_9cm Instant m³/m³
soilMoisture_9_27cm Instant m³/m³
soilMoisture_27_81cm Instant m³/m³
allHourly - -

Daily Functions:

Variable Unit
temperature_2mMax °C (°F)
temperature_2mMin °C (°F)
apparentTemperatureMax °C (°F)
apparentTemperatureMin °C (°F)
precipitationSum mm
precipitationHours hours
dailyWeatherCode WMO code
sunrise iso8601
sunset iso8601
windSpeed_10mMax km/h (mph, m/s, knots)
windGusts_10mMax km/h (mph, m/s, knots)
windDirection_10mDominant °
shortwaveRadiationSum MJ/m²
allDaily -

WMO Weather interpretation codes (WW):

Code Description
0 Clear sky
1, 2, 3 Mainly clear, partly cloudy, and overcast
45, 48 Fog and depositing rime fog
51, 53, 55 Drizzle: Light, moderate, and dense intensity
56, 57 Freezing Drizzle: Light and dense intensity
61, 63, 65 Rain: Slight, moderate, and heavy intensity
66, 67 Freezing Rain: Light and heavy intensity
71, 73, 75 Snowfall: Slight, moderate, and heavy intensity
77 Snow grains
80, 81, 82 Rain showers: Slight, moderate, and violent
85, 86 Snow showers slight and heavy
95 * Thunderstorm: Slight or moderate
96, 99 * Thunderstorm with slight and heavy hail

Testing

composer test

Support

Image for sponsor

Or

Ko-fiBuymeacoffeePaypal

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

astrodog/laravel-weather 适用场景与选型建议

astrodog/laravel-weather 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「laravel-weather」 「MichaelNabil230」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 astrodog/laravel-weather 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 astrodog/laravel-weather 我们能提供哪些服务?
定制开发 / 二次开发

基于 astrodog/laravel-weather 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-25