How dwadp/twig works
Main Components
a) Core Components:
• CLI Interface Layer
• Configuration Management System
• Command Execution Engine
• Version Detection System
• File System Interface
b) External Dependencies:
• PHP Runtime(s)
• Composer
• Project's composer.json files
┌─ User Interface Layer ─────────────────────┐
• CLI Commands (cmd/twig/*.go) │
• ┬─────────────────────────┘
• ↓
┌─ Core Services Layer ──────────────────────┐
• ┌─────────────┐ ┌──────────┐ ┌────────┐ │
• Config │ │ Schema │ │ Twig │ │
• Management │ │ Parser │ │ Engine │ │
• ┘ └──────────┘ └────────┘ │
• ┬─────────────────────────┘
• ↓
┌─ External Interface Layer ─────────────────┐
• PHP Version Management │
• Composer Integration │
• File System Operations │
• ┬─────────────────────────┘
• ↓
┌─ External Dependencies ───────────────────┐
• PHP Runtimes │
• Composer │
• Project Files (composer.json) │
• ┘
Component Details
a) Command Components (Rectangle, Blue):
• Root Command
• Config Commands (init, reload, set-default)
• PHP Command
• Composer Command
b) Core Services (Hexagon, Green):
• Configuration Management (/pkg/config)
• Schema Parsing (/pkg/schema)
• Twig Engine (/pkg/twig)
• Configuration Store (inmem_store)
• File System Interface
• PHP Runtimes
• Composer
• Project Files
Flow Indicators
• Command flow from CLI to core services
• Configuration reading/writing operations
• Version detection flow
• Command execution flow to external systems
Additional Notes
• Version information handling
• Configuration file locations
• How PHP version detection works
• Composer command proxying flow
External system interactions
Remember to include cross-platform considerations and how the system handles different operating systems, as indicated by the separate Unix and Windows implementations in the twig package.