承接 oldman10000/weather-app 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

oldman10000/weather-app

Composer 安装命令:

composer create-project oldman10000/weather-app

包简介

Gets 5 day weather forecast for a guest identified only by IP address

README 文档

README

Use your IP address to retrieve a simple 5 day weather forecast using AccuWeather Api.

How to install in your Laravel Project

Enter the below command in your project directory.

composer require oldman10000/weather-app:^1.0.*

This will install the package in your vendor directory.

At this point it is probably not a bad idea to clear your cache to make sure everything installs correctly.

php artisan cache:clear php artisan route:clear php artisan view:clear

It is also sensible to run the following command to make sure the migrations classes work correctly.

composer dump-autoload

As a failsafe, you can publish all the vendor files within your local project with the following command. This also allows you to overwrite code should you so choose.

php artisan vendor:publish --provider="Oldman10000\WeatherApp\WeatherAppServiceProvider"

It will be necessary anyway to publish the public folder which includes some CSS and icons.

php artisan vendor:publish --tag=public --force

You will need to create a database in SQL using the command.

create database weatherapp;

To migrate the new tables run the command:

php artisan migrate

View the project

Test that the site is running correctly by starting up your development host

php artisan serve

Go to [localhost]/weather in your browser which will be the 'homepage' for this project. On a live site the input field will autofill with the client IP address but on a dev server there isn't much point to this as it will just show 127.0.0.1 localhost IP. You can find your IP address on this website or simply by googling it. When you enter the ip address you will be redirected to a page displaying the 5 day forecast for the location of your IP address. Results shown below for IP address 156.0.201.255

image

Useful CLI commands

It is possible to add IP addresses to the database using the following command:

php artisan create:insert-ipaddresses {ip address}

Get weather data for your ip address directly in the CLI with

php artisan get:weather-data {ip-address}

Improvements

  • There is no form validation for the main IP Address form field. The result is that if an invalid IP address is entered, the API returns location data for Ashburn, VA, USA, which is likely the default or first value in their data. It would actually be more useful to us if an error were to be returned in this case rather than to receive incorrect data. It would therefore be nice to add some kind of validation for API addresses to throw an error. There is likely a php package that does this which may be worth researching.

  • I noticed that the days returned by the API were sometimes incorrect, which appears to be due to the timezone. The result in the screenshot below was fetched from the API on the 11th September, however as can be seen the first date shown is the 10th September. The AccuWeather API collects weather data only a couple of times a day, once in the morning and once in the evening so it appears at the time that the API collected the data, it was still the 10th September locally (in the UK) but the 11th September in St Lucia as it is GMT+10 over there.

    image

    This is a shortcoming of the API, there are however probably a couple of ways to fix the output here. The first thing that came to mind was to pull the 10 day forecast instead of the 5 day forecast as it currently does. Then Simply display the 5 days starting from the first date which matches 'today' locally.

oldman10000/weather-app 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-09-10