nihl / weatherreport
Anax天气模块
v1.1.0
2020-12-16 11:19 UTC
Requires
- php: ^7.2
Requires (Dev)
- anax/anax-cli: ^1.2
- anax/cache: ^2.0
- anax/commons: ^2.0.0@alpha
- anax/configure: ^2.0.0@alpha
- anax/controller: ^2.0.0@alpha
- anax/di: ^2.0.0@alpha
- anax/page: ^2.0.0@beta
- anax/request: ^2.0.0@beta
- anax/response: ^2.0.0@beta
- anax/url: ^2.0.0@alpha
- anax/view: ^2.0.0@beta
- phpunit/phpunit: ^7
README
Anax天气报告模块,用于获取和显示天气预报数据。
该模块设计用于与外部服务 ipstack 和 openweathermap 结合使用。
安装
1:
使用composer将此模块安装到现有的Anax安装中。
composer require nihl/weatherreport
2:
使用以下命令复制配置以集成它
# Root of your Anax based repository
rsync -av vendor/nihl/weatherreport/config ./
rsync -av vendor/nihl/weatherreport/view ./
# If you want to test the source code you can also copy the test-catalogue
rsync -av vendor/nihl/weatherreport/test ./
# If you want to edit the source code you can also copy the src-catalogue
rsync -av vendor/nihl/weatherreport/src ./
3:
在 ipstack 和 openweathermap 注册账户。更新apikey-configuration文件以包含ipstack和openweathermap的API密钥
# config/apikeys.php
return $apikeys = [
"ipstack" => "your_ipstack_apikey",
"openweather" => "your_openweathermap_apikey"
];
4:
将apikey-configuration文件添加到您的 .gitignore 文件中。
# .gitignore
config/apikeys.php
5:
weatherreport模块现在已在您的Anax安装中可用。
使用以下代码将其添加到您的导航栏中
# config/navbar/header
return [
"items" => [
...
[
"text" => "Weather",
"url" => "weatherreport",
"title" => "Weather report",
"submenu" => [
"items" => [
[
"text" => "Rest API",
"url" => "weatherreport/api",
"title" => "Weather report-API"
],
],
],
],
],
];
依赖关系
这是一个Anax模块,其主要用途是与Anax框架一起使用。
您可以在 anax/anax 上安装一个实例,并在其中运行此模块以进行测试和开发。
仓库 "my redovisa-page" 是如何做到这一点的示例。