Skip to content

Commit

Permalink
Version 2.0 (#2)
Browse files Browse the repository at this point in the history
Changed to class
Added support for Composer
Removed stations folder as it is not necessary
  • Loading branch information
DanielKrasny authored Oct 12, 2020
1 parent 57289ca commit d6df76d
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 1,343 deletions.
40 changes: 8 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,18 @@
# PovodiAPI
![PovodiAPI](https://repository-images.githubusercontent.com/202905193/358d5c00-c2b0-11e9-9209-86d8a0b79280)
Get water info in a simple API. This PHP class supports [Povodí Labe](http://www.pla.cz), [Povodí Odry](https://www.pod.cz), [Povodí Ohře](https://www.poh.cz) and [Povodí Vltavy](http://www.pvl.cz).
Get water info in a simple class. This PHP class supports [Povodí Moravy](http://www.pmo.cz), [Povodí Labe](http://www.pla.cz), [Povodí Odry](https://www.pod.cz), [Povodí Ohře](https://www.poh.cz) and [Povodí Vltavy](http://www.pvl.cz).

## Usage
### Nádrže
## Initialization
PovodiAPI is available in Composer:
```
./povodiapi.php?website=pla&channel=nadrze&station=100|1&response=json&values=all
composer require danielkrasny/povodiapi
```
Required to enter:
- *website*: **pla**, **pod**, **poh**, **pvl**
- *channel*: **nadrze** (used for this example), **sap**, **srazky**
- *station*: ID of station, available in [/stations](/stations)
- *response*: **json**, **rss**
- *values*: **all**, **latest**

### SaP (Stavy a průtoky)
```
./povodiapi.php?website=pla&channel=sap&station=9|1&response=json&values=all
Then use it as a class:
```php
$povodi = new DanielKrasny\PovodiAPI();
```
Required to enter:
- *website*: **pla**, **pod**, **poh**, **pvl**
- *channel*: **nadrze**, **sap** (used for this example), **srazky**
- *station*: ID of station, available in [/stations](/stations)
- *response*: **json**, **rss**
- *values*: **all**, **latest**

### Srážky
```
./povodiapi.php?website=pla&channel=srazky&station=215|1&response=json&values=latest
```
Required to enter:
- *website*: **pla**, **pod**, **poh**, **pvl**
- *channel*: **nadrze**, **sap**, **srazky** (used for this example)
- *station*: ID of station, available in [/stations](/stations)
- *response*: **json**, **rss**
Optional:
- *values*: **all**, **latest** (including total value), **total**
- *temp*: Only for `rss` response, channel `srazky` and set values to `all`. Allow showing temperature in title. Options: **yes**, **no**
More examples available in [wiki](https://github.com/DanielKrasny/PovodiAPI/wiki).

##### License
The script is available under the [MIT license](/LICENSE).
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "danielkrasny/povodiapi",
"description": "Get water info from Povodí Labe/Odry/Ohře/Moravy/Vltavy in a simple class.",
"keywords": [
"php",
"water",
"czech",
"api",
"php class",
"povodi",
"odra",
"labe",
"ohre",
"vltava",
"morava"
],
"homepage": "https://github.com/DanielKrasny/PovodiAPI",
"license": "MIT",
"authors": [
{
"name": "Daniel Krásný",
"role": "Developer",
"homepage": "https://daniel.krasny.me"
}
],
"support": {
"issues": "https://github.com/DanielKrasny/PovodiAPI/issues",
"source": "https://github.com/DanielKrasny/PovodiAPI/tree/master"
},
"autoload": {
"classmap": [
"povodiapi.php"
]
},
"require": {
"php": ">=5.2.0",
"ext-curl": "*",
"ext-xml": "*",
"ext-dom": "*"
}
}
357 changes: 148 additions & 209 deletions povodiapi.php

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions stations/pla_nadrze.txt

This file was deleted.

121 changes: 0 additions & 121 deletions stations/pla_sap.txt

This file was deleted.

79 changes: 0 additions & 79 deletions stations/pla_srazky.txt

This file was deleted.

7 changes: 0 additions & 7 deletions stations/pod_nadrze.txt

This file was deleted.

69 changes: 0 additions & 69 deletions stations/pod_sap.txt

This file was deleted.

Loading

0 comments on commit d6df76d

Please sign in to comment.