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

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

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

grigorygerasimov/laravel-weather

Composer 安装命令:

composer require grigorygerasimov/laravel-weather

包简介

Laravel package based on WeatherAPI

README 文档

README

Laravel package for weather and geo info based on WeatherAPI (JSON RestAPI only)

Installation

The package can be installed via Composer:

composer require grigorygerasimov/laravel-weather

You don't need to register the package Service Provider - this will be done automatically once you install the package.

For publishing the package config please run the following command. There are also some example views and the package docs under the same tag.

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

Start

Once the package is installed and the config is published, you are free to use the package in your Laravel projects.

All you need to do is to use the Weather facade (GrigoryGerasimov\Weather\Facades\Weather) and build custom fluent interfaces, e.g.:

Weather::api('forecast')->city('Prague')->forecastDays(3)->requireAQI(true)->requireAlerts(true)->requireTides(true)->lang('cs')->get();

The api() method is mandatory, as it configures the relevant api method and api key.

By default the WeatherAPI Free plan key is used, however you can always adjust it in the laravel-weather config, if you have your own WeatherAPI key.

As for the api methods, the following ones are available.

current
forecast
search
history
marine
future
timezone
sports
astronomy
ip

By default, the current method is used. Please note that the default WeatherAPI Free plan key is limited for the history method.

The available Weather facade methods are:

api(string $type = 'current')
coords(float|string $lat, float|string $lon)
city(string $city)
zip(string $zipCode)
metar(string $metarCode)
iata(string $iataCode)
autoIp()
ip(string $ip)
forecastDays(int $days = 1)
historyFutureDate(string $date)
historyDate(string $date)
forecastHistoryTimestamp(string|int $timestamp)
historyTimestamp(string|int $timestamp)
forecastHistoryHour(int $hour)
requireAlerts(bool $shouldAlert = false)
requireAQI(bool $ifAqi = false)
requireTides(bool $ifTides = false)
withInterval()
lang(string $langCode)
get()
uri()

The facade method get() will provide you with the result of your request, however you can also access the request uri directly via the uri() method.

For demonstration purpose, the package also includes a number of components and views to the basic Weather api methods. These views are some very simple data lists without any particular styling, they serve merely for the visual representation of the weather and geo info retrieved with the help of this package. You can check them out under the following web-routes

For further details, you can also check the weather controller and components

Screenshot 2023-06-18 at 11 25 36 Screenshot 2023-06-18 at 11 26 11 Screenshot 2023-06-18 at 11 26 43 Screenshot 2023-06-18 at 11 27 33

Documentation

For the detailed infos on the package structure and api, please refer to the Laravel-Weather documentation which is published into your public folder. While running the php artisan serve command, you can access the docs as follows:

http://localhost:8000/vendor/laravel-weather/docs/index.html

Please don't forget to refer to the official WeatherAPI documentation to get a better glimpse of the weather and geo data via a JSON RestAPI.

License

The package is under MIT license, thus you are free to use it in your projects.

Feedback

As I've never had any previous experience in creating packages, I would appreciate some feedback: whether the Laravel-Weather package is easy/hard to use, what can be improved etc.

Feel free to get in touch with me under rehor.ger@gmail.com

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-18