How yiisoft/yii2 works
Main Components
a. Core Framework Layer:
• Base Components (framework/base/)
• Database Layer (framework/db/)
• Caching System (framework/caching/)
• Security Components (framework/rbac/)
• Web Components (framework/web/)
• Console Components (framework/console/)
b. Service Layer:
• Dependency Injection Container (framework/di/)
• Service Locator
• Event Handling System
c. MVC Components:
• Models (Active Record implementation)
• Views & Widgets
• Controllers
• URL Management
[Client Layer]
• ↑↓
[Web/Console Entry Points]
• ↑↓
[Application Layer]
• ↑↓
[Core Framework Components]
• ↑↓
[Service Layer]
• ↑↓
[Database/Storage Layer]
Key Relationships
a. Request Flow:
• HTTP Request → URL Manager → Controller → Action → View
• Console Request → Command → Action
b. Data Flow:
• Models ↔ Database
• Controllers ↔ Models
• Views ↔ Controllers
c. Service Interactions:
• Dependency Injection connections
• Event handling paths
• Caching system integration
Important Subsystems
• RBAC (Role-Based Access Control)
• Caching architecture
• Database abstraction layer
• Asset management system
• Client Layer |
• Application |
• Infrastructure |
• Core Services |
• Data Access |
Remember to:
• Keep the abstraction level consistent
• Architectural relationships
• Version compatibility notes
• Document integration points
• Configuration flows