bjos19/anax-weathermodule

V1.0.4 2020-12-10 15:49 UTC

This package is auto-updated.

Last update: 2024-09-11 00:17:00 UTC


README

徽章

Travis-CI
Build Status
CircleCI
<ORG_NAME>
Scrutinzer
Scrutinizer Code Quality
Code Coverage
Build Status
Code Intelligence Status
Codeclimate
Maintainability
SymfonyInsight
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