mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
2.3 KiB
2.3 KiB
Analysis: Proposed PHP Structure Reorganization
Summary
The proposed structure is a standard Laravel/Symfony-inspired architecture, but overengineered for this project's scale and conflicts with existing architectural decisions.
Key Issues
1. Redundant Separation
The project already has good separation of concerns:
- Controllers in
src/(14 focused classes) - Templates in
templates/ - Data in
storage/(outside web root) - Organized tests
2. Conflicts with Existing Decisions
docs/orm-assessment.mdexplicitly decided against Doctrine/ORM → Proposedsrc/Model/entities contradict this- No Composer in current project → Proposed structure requires PSR-4 autoloading
App.phpalready does the job → AddingCore/AppKernel.phpis redundant
3. Overengineering
- Repository + Service + Model layers for a ~15 page SQLite app creates 3x the code
ThesisCreationService,AuthService,ExportServicesplit logic that's currently cohesiveConfig/Settings.phpreplaces workingconfig/bootstrap.phpfor no clear benefit
What Actually Makes Sense
High Value, Low Cost:
.envfor secrets → Replace hardcoded credentials pattern- Single entry point → Move to
public/index.phprouting (requires nginx config changes) - Keep logic out of
public/→ Already partially achieved
Medium Value:
- Consolidate
src/classes → Group into subdirectories without full MVC overhaul - Move
test.dbfrom root → Intostorage/where it belongs
Low Value (Skip):
- Entity classes (conflicts with ORM assessment)
- Repository pattern (SQLite direct access is fine)
- Service layer over-splitting
- Composer integration (unless you need PHP packages)
Recommendation
Do NOT adopt the full proposed structure.
Instead, make incremental improvements:
- Add
.envsupport - Consolidate to single entry point
- Organize
src/into logical subdirectories - Move stray files to proper locations
This achieves 80% of the benefits at 20% of the cost.
Questions to Consider
- Are you planning to add external PHP dependencies? (If yes, Composer makes sense)
- Do you expect multiple developers to work on this simultaneously? (Justifies stricter structure)
- Is the current codebase difficult to maintain? (If no, restructure is premature optimization)