zerolfc / ecce-weather-forecast
:package_description
dev-main
2022-05-30 10:26 UTC
Requires
- php: ^7.3
- illuminate/config: ^8.0|^9.0
- illuminate/console: ^8.0|^9.0
- illuminate/database: ^8.0|^9.0
- illuminate/http: ^8.0|^9.0
- illuminate/pagination: ^8.0|^9.0
- illuminate/support: ^8.0|^9.0
Requires (Dev)
- orchestra/testbench: ~6
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2024-09-29 06:09:08 UTC
README
天气服务提供商
此包目前仅支持两个免费天气API提供商。
-
weatherapi.com - 免费层仅显示3天的每日天气。
-
open-meteo.com - 不支持图标来表示预报的天气。
安装
composer require zerolfc/ecce-weather-forecast
查看
根据您如何设置本地服务器
http://{local-url}/forecast
配置
默认设置在 config/ecce-weather-forecast.php
中设置。发布配置时,将文件复制到您自己的配置
php artisan vendor:publish --tag="ecce-weather-forecast.config"
php artisan vendor:publish --tag="ecce-weather-forecast.migrations"
文件。
将以下变量添加到您的 .env
文件中。
支持的提供商是 weatherapi
或 open-meteo
。
WEATHER_FORECAST_PROVIDER=weatherapi
WEATHER_FORECAST_KEY=
Artisan
您可以使用 artisan 终端使用天气预报。
php artisan forecast:check {IP-address}
API
您可以通过添加 format=json
查询来访问预报的天气API。
http://location:8080/forecast/{IP}?format=json