Files
APIlite/AGENTS.md
2026-02-13 09:54:08 +01:00

1.5 KiB

AGENTS.md

Project overview

APIlite is a lightweight PHP library. A class extends TPsoft\APIlite\APIlite, public methods become API actions, requests are processed automatically, and responses are returned as JSON.

The project also generates frontend clients:

  • JavaScript client: format=javascript (.js)
  • TypeScript client: format=typescript (.ts, real typed output)

Core files

  • src/APIlite.php: runtime, routing, docs JSON/HTML/client generation
  • src/help.tpl.php: HTML documentation template
  • src/javascript.tpl.php: JavaScript client template
  • src/typescript.tpl.php: TypeScript client template
  • bin/apilite-files: helper script for bootstrapping files in consumer projects

Working rules

  • Keep API behavior backward compatible unless explicitly requested.
  • Maintain both generated clients:
    • JavaScript stays plain JS.
    • TypeScript stays typed (interfaces + typed method signatures).
  • If you change output field names in JSON help, update README and templates consistently.
  • Prefer small, focused changes over broad rewrites.

Verification checklist

  • Run syntax checks on edited PHP files:
    • php -l src/APIlite.php
    • php -l src/help.tpl.php
    • php -l src/javascript.tpl.php
    • php -l src/typescript.tpl.php
    • php -l bin/apilite-files
  • If client generation changes, test with:
    • php test/APIcalculator.php --javascript
    • php test/APIcalculator.php --typescript

Documentation rule

When output format names/flags/URLs change, update README.md in the same change set.