satmaxt/clther
Composer 安装命令:
composer require satmaxt/clther
包简介
Weather forecast package
README 文档
README
This package can find current weather status at some location by using latitude and longitude
This package use API from OpenWeatherMap
Installation
To install this package, you can easily install using composer through this command
$ composer require satmaxt/clther
Implementation
The example implementation of this package can found at example folder
System Configuration
This package use default configuration that defined at package src folder.
To change system configuration, you can create a constant.php file. The example can found at example folder
<?php // mode (DEVELOPMENT OR PRODUCTION) $constant['SYSTEM_MODE'] = 'PRODUCTION'; // latitude longitude Bandung City $constant['LATITUDE'] = -6.9042112; $constant['LONGITUDE'] = 107.5882227; // Units (Metric = Celcius, Imperial = Fahrenheit, Default = Kelvin) $constant['UNITS'] = 'metric'; // system constant $constant['PRODUCTION_API_URL'] = 'https://api.openweathermap.org'; $constant['DEVELOPMENT_API_URL'] = 'https://samples.openweathermap.org'; $constant['PRODUCTION_APP_ID'] = 'yourapikey'; $constant['DEVELOPMENT_APP_ID'] = 'b6907d289e10d714a6e88b30761fae22'; $constant['CONSTANT_PATH'] = __DIR__ . '/constant.php'; // custom constant file $constant['SYSTEM_PATH'] = __DIR__ . '/cache/weather.dat'; // cache file name
Refresh data
Weather data will updated automatically if you add this script to your crontab or cron.
Because this package use free API key, recommended refresh time is every 10 minutes
Add this script to youir cronjob:
10 * * * * php /path/to/folder/refresh.php >/dev/null 2>&1
Change /path/to/folder to your refresh.php location.
Example Output
{
"coord": {
"lon": 107.59,
"lat": -6.9
},
"weather": {
"time": "2019-08-08 14:14:33",
"icon": "https:\/\/openweathermap.org\/img\/wn\/04d@2x.png",
"status": "Clouds",
"description": "broken clouds"
},
"main": {
"temp": 28.56,
"pressure": 1011.11,
"humidity": 34,
"temp_min": 28.56,
"temp_max": 28.56,
"sea_level": 1011.11,
"grnd_level": 906.98
},
"units": "metric"
}
Copyright © 2019. Satmaxt Developer. Coded with ❤️ & ☕ at Bandung
satmaxt/clther 适用场景与选型建议
satmaxt/clther 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「weather」 「open weather」 「openweather」 「api weather」 「clther」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 satmaxt/clther 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 satmaxt/clther 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 satmaxt/clther 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Netgen Open Graph Bundle is an Ibexa Platform bundle that allows simple integration with Open Graph protocol.
A tool for scraping URL resources (oEmbed, OpenGraph, Twitter cards, JSON-LD)
Laravel-forecast provides a service provider and a facade around the Forecast-php wrapper
A Laravel SDK for OpenWeather API
Add a weather widget to Flarum
Simple weather forecaster for Laravel
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-26