Rethinking PHP: I Built a 30MB "Web Operating Environment" Inspired by OS Architecture
Description and use
Domain System is a ~30 MB PHP platform that treats the stack as an OS with Ring 0 core and Ring 3 plugins, offering isolation, atomic JSON storage, sandboxing, and AI‑friendly development.
Problem
Develop a lightweight, modular web application platform that treats a PHP/Linux stack as a Web Operating Environment, reducing size and improving resilience.
Outcome
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.
Workflow
- 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).
Evidence
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.
- Record date: 2026-11-01T09:29:08.309Z