fix(autoload): canary DomainModel after Composer load

Stale vendor/ after the PSR-4 cutover omits AKSRT\ from
autoload_psr4, so helpers fatal on DomainModel constants.
Fail loud with composer install/dump-autoload guidance and
document the deploy step in README + ADR.
This commit is contained in:
2026-07-17 19:30:53 +08:00
parent d48cdac28c
commit 34b7aa7a91
3 changed files with 57 additions and 6 deletions
+5 -2
View File
@@ -42,8 +42,11 @@ Domain folders were frozen after the root→domain move. Theme types then migrat
### Loader
1. `functions.php` loads `vendor/autoload.php` (Composer: third-party + theme PSR-4)
2. `inc/bootstrap.php` loads helpers + procedural modules (`inc/modules/*`) + core-hooks only
3. Singleton `init()` remains in `functions.php` using FQCNs
2. Immediately after, canary `class_exists(\AKSRT\Core\DomainModel::class)` — if missing, `wp_die` with `composer install` / `composer dump-autoload -o` (stale `vendor/` after PSR-4 cutover is the common failure)
3. `inc/bootstrap.php` loads helpers + procedural modules (`inc/modules/*`) + core-hooks only
4. Singleton `init()` remains in `functions.php` using FQCNs
Deploy note: `vendor/` is gitignored. After pull/upload, run `composer install --no-dev --optimize-autoloader` (or at least `composer dump-autoload -o`) in the theme root so `autoload_psr4` includes `"AKSRT\\": ["…/src/AKSRT"]`.
### Procedural (not PSR-4)