added version 1.0.0 of APIlite library,

added basic HTML template for help,
added test class APIcalculator for demo
This commit is contained in:
2025-05-28 09:50:45 +02:00
parent 1a6e173da9
commit 59b317cacd
3 changed files with 421 additions and 0 deletions

37
src/help.tpl.php Normal file
View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $this->apiName; ?></title>
</head>
<body>
<h1><?php echo $this->apiName; ?></h1>
<p>API documentation in <a href="<?php echo $this->getCurrentUrl(); ?>?format=json">JSON</a></p>
<p>API endpoint URL <a href="<?php echo $this->getCurrentUrl(); ?>"><?php echo $this->getCurrentUrl(); ?></a></p>
<?php if (is_array($this->methods)) foreach ($this->methods as $index => $method) { ?>
<h2><?php echo $method['name']; ?></h2>
<i><?php echo $method['description']; ?></i>
<p>Endpoint URL: <a href="<?php echo $this->getCurrentUrl(); ?>?action=<?php echo $method['name']; ?>"><?php echo $this->getCurrentUrl(); ?>?action=<?php echo $method['name']; ?></a></p>
<?php if (is_array($method['params'])) foreach ($method['params'] as $param) { ?>
<p>
<?php echo $param['name']; ?>: <code><?php echo $param['type']; ?></code>
&mdash;
<?php
if ($param['optional']) echo '(optional) ';
echo $param['doc'];
?>
</p>
<?php } ?>
<?php } ?>
</body>
</html>