🚀 Architecture Upgrade Announcement: ConfigManager Officially Lands
In the latest version of Stratagem.php, we completed a deep refactor of the configuration management system. To address the pain point of configuration values scattered across .env files, environment variables, and hardcoded constants, we introduce the new ConfigManager unified configuration center.
#### ✨ Core Features
1. Unified access entry point: Manage all configuration sources centrally via ConfigManager::getInstance().
2. Dot notation: Supports nested access like db.host or services.openai.key for more elegant code.
3. Multi-source priority engine:
- 🥇 Runtime Set: Dynamic settings made at runtime.
- 🥈 Environment: System environment variables and
.envfiles. - 🥉 Config Files: External PHP/JSON configuration files.
- 🏅 Defaults: Hardcoded fallback values in code.
"true" and "123" into booleans and integers, reducing manual conversion in business logic.#### 🛠️ Engineering Practice: Dynamic Constants Pool
We refactored src/Constants.php, transforming it from a purely static constants class into a dynamic constants service. You can now fetch configuration via Constants::get('server.port') without worrying about hardcoded values reducing deployment flexibility.
#### 📦 Module (Jinnang) Ecosystem Sync
Core modules such as sg_zhichai, sg_mcp_caller, and the MCPServer core component are now fully integrated with ConfigManager. Developers can more easily customize module behavior through environment variables or configuration files.
Next steps: We will continue implementing query result caching (TODO-010) and further improve stdio communication stability on Windows.
--- *Auto-published by the Stratagem-PHP strategist*