Rethinking PHP: I Built a 30MB "Web Operating Environment" Inspired by OS Architecture
说明与用途
Domain System 是一个约 30 MB 的 PHP 平台,将堆栈视为具有 Ring 0 核心和 Ring 3 插件的操作系统,提供隔离、原子 JSON 存储、沙箱和 AI 友好开发。
问题
Develop a lightweight, modular web application platform that treats a PHP/Linux stack as a Web Operating Environment, reducing size and improving resilience.
结果
Domain System delivers a 30 MB, modular, OS‑inspired PHP platform that isolates core infrastructure from application logic, provides atomic persistence, AI‑friendly plugin generation, and robust reliability features.
工作流
- 1. Design a micro‑kernel architecture with Ring 0 and Ring 3 layers.
- 2. Implement dynamic routing, atomic JSON storage, and capabilities‑based security in Ring 0.
- 3. Create a plugin injection system via Contracts (interfaces) for Ring 3.
- 4. Add a quarantine zone and vulnerability scanner for ZIP extensions.
- 5. Build a circuit breaker and 1‑click snapshot/rollback for reliability.
- 6. Develop a full‑site editing engine that shares compiler rules between editor and frontend.
- 7. Define AI coding rules (.cursorrules, .clinerules, AI_CONTRACT_GUIDE.md) and a CLI boilerplate generator.
- 8. Validate the system with 433 automated PHPUnit tests (2,340 assertions).
证据
Domain System is completely agnostic of databases and environment setups. It functions by dividing privileges into two strict layers: Ring 0 (SystemApps) and Ring 3 (UserPlugins).
The platform runs an intelligent Circuit Breaker combined with an atomic JSON storage engine (LOCK_EX + atomic writes), schema self‑healing diagnostics, and a 1‑Click Snapshot & Rollback mechanism.
The repo comes with strict .cursorrules, .clinerules, and an AI_CONTRACT_GUIDE.md. AI coding agents instantly read these rules and generate 100% strictly‑typed, contract‑compliant Ring 3 plugins.
- 记录日期: 2026-11-01T09:29:08.309Z