bjos19 / anax-weathermodule
Anax天气模块
V1.0.4
2020-12-10 15:49 UTC
Requires
- php: >=7.4
Requires (Dev)
- anax/anax: ^2.0.17
- anax/commons: ^2.0.14
- phpunit/phpunit: ^7
README
徽章
Travis-CI
CircleCI
Scrutinzer
Codeclimate
SymfonyInsight
安装
此模块可在 packagist 上找到
步骤 1 安装模块
使用composer安装
composer require bjos19/anax-weathermodule
步骤 2 复制配置文件和其他必要的文件夹。
您可以从 vendor/bjos19/anax-weathermodule
分别复制所有文件,或者站在您的Anax仓库的根目录下,使用以下命令复制所有文件:
rsync -av vendor/bjos19/anax-weathermodule/config ./
rsync -av vendor/bjos19/anax-weathermodule/src ./
rsync -av vendor/bjos19/anax-weathermodule/view ./
rsync -av vendor/bjos19/anax-weathermodule/test ./
步骤 3 添加命名空间
将命名空间 Bjos
添加到 composer.json
中,并运行命令 composer dump-autoload
。
"autoload": {
"psr-4": {
"Anax\\": "src/",
"Bjos\\": "src/"
}
},
测试
运行命令 make test
以检查代码是否验证通过。
要正确使用该模块,您必须添加 2 个 API 密钥
从 ipstack 添加 API 密钥
创建文件 /config/api_ipstack.php
并复制以下代码,或重命名文件 /config/api_ipstack_sample.php
。
<?php
return [
"apiKey" => "Replace this with valid Apikey"
];
从 openweathermap one-call-api 添加 API 密钥
创建文件 /config/api_owm.php
并复制以下代码,或重命名文件 /config/api_owm_sample.php
。
<?php
return [
"apiKey" => "Replace this with valid Apikey"
];
路由
按照上述步骤操作后,以下路由将可用。
/api
/weather
/weatherapi
/ip
/ip-json
/geo
/geoapi