nihl / weatherreport
Anax weather module
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 weather report module for fetching and displaying weather prognosis data.
The module is designed to be used with external services ipstack and openweathermap.
Installation
1:
Install this module into your existing Anax installation using composer.
composer require nihl/weatherreport
2:
Integrate it by copying the configuration using the following command:
# 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:
Sign up for an account at ipstack and openweathermap.
Update apikey-configuration file with your apikeys for ipstack and openweathermap:
# config/apikeys.php
return $apikeys = [
"ipstack" => "your_ipstack_apikey",
"openweather" => "your_openweathermap_apikey"
];
4:
Add your apikey-configuration file to your .gitignore
.
# .gitignore
config/apikeys.php
5:
The weatherreport module is now available in your Anax installation.
Add it to your navbar with the following code:
# config/navbar/header
return [
"items" => [
...
[
"text" => "Weather",
"url" => "weatherreport",
"title" => "Weather report",
"submenu" => [
"items" => [
[
"text" => "Rest API",
"url" => "weatherreport/api",
"title" => "Weather report-API"
],
],
],
],
],
];
Dependency
This is a Anax module and its usage is primarly intended to be together with the Anax framework.
You can install an instance on anax/anax and run this module inside it, to try it out for test and development.
The repo "my redovisa-page" is an example of how that can be done.