Skip to content

feat: auto-discover API functions via attributes and ClassDiscovery#6483

Merged
gharlan merged 1 commit into6.xfrom
feat/api-function-auto-discovery
Apr 12, 2026
Merged

feat: auto-discover API functions via attributes and ClassDiscovery#6483
gharlan merged 1 commit into6.xfrom
feat/api-function-auto-discovery

Conversation

@gharlan
Copy link
Copy Markdown
Member

@gharlan gharlan commented Apr 12, 2026

Summary

  • Neuer ClassDiscovery-Service, der Klassen über Composers ClassLoader (Classmap + PSR-4-Fallback) in Core, aktiven Addons und Projekt-Code findet
  • Neues PHP-Attribut #[AsApiFunction('name')] zur deklarativen Registrierung von API-Funktionen
  • Alle 23 Core-API-Funktionen und die Debug-Addon-API-Funktion mit dem Attribut annotiert
  • ApiFunction::register() bleibt als alternativer Weg bestehen
  • Cache mit xxh128-Hash-Invalidierung basierend auf aktiven Addons; im Debug-Modus zusätzlich ein Dateilisten-Hash, damit neue Klassen sofort ohne manuelles Cache-Löschen gefunden werden
  • Perspektivisch kann ClassDiscovery auch für Media-Effekte, Cronjob-Types etc. genutzt werden

🤖 Generated with Claude Code

Replace the hardcoded API function registry with automatic class discovery
using PHP attributes. Each API function class is now annotated with
#[AsApiFunction('name')] and discovered at runtime via the new ClassDiscovery
service, which scans Composer's classmap and PSR-4 directories filtered to
core, active addons, and project-level code.

The cache uses xxh128 hashing for addon-based invalidation, with an additional
file-listing hash check in debug mode so new classes are found immediately
without manual cache clearing.

ApiFunction::register() remains available as an alternative to attributes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rex-bot rex-bot added the feature Additional functionality label Apr 12, 2026
@gharlan gharlan added this to the REDAXO 6.0 milestone Apr 12, 2026
@gharlan gharlan merged commit 60be808 into 6.x Apr 12, 2026
16 checks passed
@gharlan gharlan deleted the feat/api-function-auto-discovery branch April 12, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Additional functionality

Development

Successfully merging this pull request may close these issues.

2 participants