How luke-keaweb/archway works
Project type and purpose
• This is a PHP‑based full‑stack web application.
• Purpose: Provide a frontend search UI that queries Archives NZ backend APIs, caches certain lookups in a local MySQL database, and renders results with custom templates and assets.
File structure
• Top‑level:
• .env.example / composer.json → environment and dependency management
• classes/ → all core PHP classes (Router, controllers, services, templates)
• functions.php → shared helper functions
• public/ → document root: index.php, CSS/JS assets, HTAccess
• html/ → static example pages
• Notice the public/index.php entry point uses classes/Router.class.php to dispatch routes to controller classes.
• Persistence: MySQL (SQL import), plus a local cache folder and cookie.txt for file‑system caching.
README for additional insights
• Routes: defined in Router → call methods on classes like AimsSearch, Entity, etc.
• AimsSearch calls external Archives NZ API (JSON) → parsed by ResultParser → formatted with FormatData.
• Series, Agency, Flickr classes perform DB lookups to avoid repeated network calls.
• DefaultTemplate handles HTML skeleton; custom templates can be injected via .env.
Details to capture
• Entry point: public/index.php + .htaccess rewrite
• Routing logic in classes/Router.class.php
• Controller classes and their responsibilities (AimsSearch, Entity, FormElements, etc.)
• Data flow:
• JSON from Archives NZ → ResultParser → FormatData
• Series/Agency lookups → MySQL
• Template injection via DefaultTemplate and .env overrides
• Static assets served directly from public/assets