<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: HADEL RACHID DAHER JUNIOR</title>
    <description>The latest articles on DEV Community by HADEL RACHID DAHER JUNIOR (@hadelrachid).</description>
    <link>https://dev.to/hadelrachid</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4212038%2F08c62c14-01f6-49f2-b447-0735e3734c18.jpg</url>
      <title>DEV Community: HADEL RACHID DAHER JUNIOR</title>
      <link>https://dev.to/hadelrachid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hadelrachid"/>
    <language>en</language>
    <item>
      <title>I'm Building My Own PHP Platform, and I've Been Learning a Lot Along the Way</title>
      <dc:creator>HADEL RACHID DAHER JUNIOR</dc:creator>
      <pubDate>Thu, 29 Oct 2026 02:20:32 +0000</pubDate>
      <link>https://dev.to/hadelrachid/im-building-my-own-php-platform-and-ive-been-learning-a-lot-along-the-way-al7</link>
      <guid>https://dev.to/hadelrachid/im-building-my-own-php-platform-and-ive-been-learning-a-lot-along-the-way-al7</guid>
      <description>&lt;h1&gt;
  
  
  I'm Building My Own PHP Platform, and I've Been Learning a Lot Along the Way
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Febmhwf5e70u9lcj98l4n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Febmhwf5e70u9lcj98l4n.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm a self-taught developer, and for some time now, I've been working on a project called &lt;strong&gt;Domain System&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It started with an idea: what if I could build my own PHP platform, where the main system and its plugins had their own responsibilities and didn't depend too much on each other?&lt;/p&gt;

&lt;p&gt;As I kept working on it, the project grew. I had to think about how to organize the code, how plugins should communicate with the core, how to handle errors, and how to avoid breaking something that was already working.&lt;/p&gt;

&lt;p&gt;I won't pretend I have all the answers. I'm still learning, making mistakes, and going back to improve things. But that's part of what makes this project interesting to me.&lt;/p&gt;

&lt;p&gt;You can find it on GitHub here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/hadelrachid/domain-system" rel="noopener noreferrer"&gt;https://github.com/hadelrachid/domain-system&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I started thinking differently about PHP
&lt;/h2&gt;

&lt;p&gt;When I started thinking about how to organize the project, I became interested in how operating systems separate their essential parts from the applications that run on top of them.&lt;/p&gt;

&lt;p&gt;I wondered if I could borrow a little of that idea for a PHP platform.&lt;/p&gt;

&lt;p&gt;In Domain System, I try to keep two things separate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The core:&lt;/strong&gt; The part responsible for things the system needs to work, such as routing, storage, and other shared services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The plugins:&lt;/strong&gt; The parts that add features to the platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The idea is simple: I don't want the core to know all the details of every plugin. I'd rather have them communicate through interfaces, so I can change one part without having to change everything else.&lt;/p&gt;

&lt;p&gt;In practice, getting this right is harder than it sounds. You can create interfaces and still end up with code that's too dependent on other classes. That's something I've been learning to pay more attention to as the project develops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some things I've been working on
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installing plugins more safely
&lt;/h3&gt;

&lt;p&gt;One thing that made me think carefully was plugin installation.&lt;/p&gt;

&lt;p&gt;When you upload a ZIP file, you can't simply assume that every file inside it is safe to extract wherever you want.&lt;/p&gt;

&lt;p&gt;So I added a step where uploaded files are checked before they're moved into place. The process includes checks for problems such as path traversal and ZIP Slip.&lt;/p&gt;

&lt;p&gt;It's not something I'd describe as a guarantee that every possible attack is prevented. Security takes more than a few checks, and I know this is an area that deserves ongoing attention.&lt;/p&gt;

&lt;h3&gt;
  
  
  Trying to make problems easier to recover from
&lt;/h3&gt;

&lt;p&gt;Another challenge is dealing with errors without leaving the system in a bad state.&lt;/p&gt;

&lt;p&gt;Domain System includes JSON storage, file-locking and atomic-write techniques, diagnostic tools, and a snapshot and rollback feature.&lt;/p&gt;

&lt;p&gt;These are attempts to make problems easier to identify and recover from. I know things can still go wrong, but I'd rather build ways to deal with failures than assume they won't happen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building my own visual page editor
&lt;/h3&gt;

&lt;p&gt;I've also been working on &lt;strong&gt;Flex Builder&lt;/strong&gt;, a visual editor for creating page layouts and theme components.&lt;/p&gt;

&lt;p&gt;One thing I wanted was for the editor preview to behave as closely as possible to the actual website. To help with that, both use the same compilation process.&lt;/p&gt;

&lt;p&gt;I've also been working on responsive layouts, so that hiding an element on a smaller screen doesn't leave awkward empty spaces behind.&lt;/p&gt;

&lt;p&gt;There are plenty of details to work through in an editor like this, and it's been a good learning experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using AI without losing control of my code
&lt;/h3&gt;

&lt;p&gt;I also use AI coding tools to help me develop the project.&lt;/p&gt;

&lt;p&gt;They can be very useful, especially when you're working on a large codebase. But I've learned that getting code that works in isolation isn't the same as getting code that fits the rest of the project.&lt;/p&gt;

&lt;p&gt;Sometimes a change can solve one problem while creating another. A new class might work, for example, but introduce dependencies that make future changes harder.&lt;/p&gt;

&lt;p&gt;To help avoid this, I've been creating documentation and rules that explain how the project is organized and how new plugins should be built. There's also a command-line tool to generate a basic plugin structure.&lt;/p&gt;

&lt;p&gt;I'm still figuring out the best way to use AI without letting the code become difficult to maintain. Documentation helps, but I still need to review the changes and understand what they're doing.&lt;/p&gt;

&lt;h3&gt;
  
  
  A little about the technology
&lt;/h3&gt;

&lt;p&gt;Domain System is built with &lt;strong&gt;PHP 8.2+&lt;/strong&gt;. It supports MySQL/MariaDB and SQLite through PDO, as well as its own JSON storage option.&lt;/p&gt;

&lt;p&gt;I use PHPUnit for automated tests. At the time of writing, the project has 433 tests and more than 2,340 assertions.&lt;/p&gt;

&lt;p&gt;Those numbers are useful, but I don't think they tell the whole story. Passing tests are important, and so is checking whether the code is organized in a way that makes sense and can be maintained over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  I'm sharing it because I'd like to learn from others
&lt;/h2&gt;

&lt;p&gt;This project has taught me that building something is one challenge; keeping it understandable as it grows is another.&lt;/p&gt;

&lt;p&gt;I'm not presenting Domain System as a finished solution or claiming that I've found the best way to build a PHP platform. It's a project I'm developing, learning from, and trying to improve.&lt;/p&gt;

&lt;p&gt;If you have a moment to look at the code, I'd really appreciate your thoughts.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does separating the core from the plugins this way make sense to you?&lt;/li&gt;
&lt;li&gt;How do you keep a PHP project organized as it grows?&lt;/li&gt;
&lt;li&gt;If you use AI to help write code, how do you make sure the changes still fit your project's design?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'd be happy to hear suggestions, questions, or even criticism. I'm sharing the project partly because I know other developers may notice things that I haven't.&lt;/p&gt;

&lt;p&gt;Here's the repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/hadelrachid/domain-system" rel="noopener noreferrer"&gt;https://github.com/hadelrachid/domain-system&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for taking the time to read this!&lt;/p&gt;

</description>
      <category>backend</category>
      <category>programming</category>
      <category>architecture</category>
      <category>php</category>
    </item>
    <item>
      <title>Rethinking PHP: I Built a 30MB "Web Operating Environment" Inspired by OS Architecture 🛸</title>
      <dc:creator>HADEL RACHID DAHER JUNIOR</dc:creator>
      <pubDate>Wed, 28 Oct 2026 03:53:27 +0000</pubDate>
      <link>https://dev.to/hadelrachid/rethinking-php-i-built-a-30mb-web-operating-environment-inspired-by-os-architecture-1l33</link>
      <guid>https://dev.to/hadelrachid/rethinking-php-i-built-a-30mb-web-operating-environment-inspired-by-os-architecture-1l33</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8ub4cs9m4qdikxlzsokv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8ub4cs9m4qdikxlzsokv.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Rethinking PHP: I Built a 30MB "Web Operating Environment" Inspired by OS Architecture 🛸
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Let's face it: when people talk about PHP, they usually think of traditional MVC frameworks like Laravel or monolithic CMS platforms like WordPress. &lt;/p&gt;

&lt;p&gt;But what if we treated a PHP/Linux stack not just as an app server, but as a &lt;strong&gt;Web Operating Environment&lt;/strong&gt;? &lt;/p&gt;

&lt;p&gt;For the past few months, I've been working on &lt;strong&gt;&lt;a href="https://github.com/hadelrachid/domain-system" rel="noopener noreferrer"&gt;Domain System&lt;/a&gt;&lt;/strong&gt;—a lightweight, modular, and hyper-resilient web application platform built from the ground up under strict &lt;strong&gt;SOLID&lt;/strong&gt; and &lt;strong&gt;Dependency Inversion (DIP)&lt;/strong&gt; principles. It takes architecture cues from real Operating Systems (Micro-kernel, protection rings, process-like isolation) and packs it all into just &lt;strong&gt;~30 MB&lt;/strong&gt; uncompressed.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 The Core Concept: OS Architecture for the Web
&lt;/h2&gt;

&lt;p&gt;Domain System is completely agnostic of databases and environment setups. It functions by dividing privileges into two strict layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ring 0 (SystemApps):&lt;/strong&gt; The core micro-kernel. It handles vital system infrastructure like dynamic routing, atomic persistence, capabilities-based security, telemetry, and contract diagnostics. &lt;strong&gt;The core never knows what the business logic does.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ring 3 (UserPlugins):&lt;/strong&gt; Where your application actually lives. Plugins are injected entirely through &lt;strong&gt;Contracts (Interfaces)&lt;/strong&gt;. They run with limited privileges and cannot hijack Ring 0 core instances.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Key Features I'm Proud Of
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🛡️ 1. Gatekeeper &amp;amp; Sandboxing
&lt;/h3&gt;

&lt;p&gt;To prevent malicious code execution from third-party ZIP extensions, the installation engine extracts uploads into a quarantine zone, scans the source code for vulnerabilities (like Path Traversal/Zip-Slip), and blocks privilege escalation before moving anything to production.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔋 2. No-Break Shield &amp;amp; Atomic JSON Store
&lt;/h3&gt;

&lt;p&gt;Say goodbye to the White Screen of Death (WSOD). The platform runs an intelligent &lt;em&gt;Circuit Breaker&lt;/em&gt; combined with an atomic JSON storage engine (&lt;code&gt;LOCK_EX&lt;/code&gt; + atomic writes), schema self-healing diagnostics (&lt;code&gt;SchemaDoctorInterface&lt;/code&gt;), and a &lt;strong&gt;1-Click Snapshot &amp;amp; Rollback&lt;/strong&gt; mechanism inside the monitoring panel.&lt;/p&gt;

&lt;h3&gt;
  
  
  🏗️ 3. Flex Builder FSE (Full Site Editing) with Auto-Reflow
&lt;/h3&gt;

&lt;p&gt;I built a frontend layout engine (&lt;code&gt;src/Core/Theme/Parts&lt;/code&gt;) where the editor preview and live frontend share the exact same compiler and validation rules. It supports responsive visibility for 4 screen resolutions. If elements in a CSS Grid column are hidden on mobile, the layout engine collapses the column and automatically recalculates the template grid on the fly.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤖 4. Built for the "Vibe Coding" Era (AI-First DX)
&lt;/h3&gt;

&lt;p&gt;I wanted this project to welcome AI-assisted development without turning into a spaghetti code nightmare. The repo comes with strict &lt;code&gt;.cursorrules&lt;/code&gt;, &lt;code&gt;.clinerules&lt;/code&gt;, and an &lt;code&gt;AI_CONTRACT_GUIDE.md&lt;/code&gt;. AI coding agents (like Claude Code, Cursor, or Cline) instantly read these rules and generate 100% strictly-typed, contract-compliant Ring 3 plugins. There's also a CLI boilerplate generator (&lt;code&gt;php os-cli.php make:plugin &amp;lt;name&amp;gt;&lt;/code&gt;).&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 Reliability
&lt;/h2&gt;

&lt;p&gt;To sleep soundly at night, the platform's engine of Hooks (Event-Driven) and Contracts is currently validated by &lt;strong&gt;433 automated tests (over 2,340 assertions)&lt;/strong&gt; using PHPUnit.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Language:&lt;/strong&gt; PHP 8.2+ (Strict typing, pure DIP)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; Agnostic (Built-in support for MySQL/MariaDB or SQLite via PDO, plus Atomic JSON)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture:&lt;/strong&gt; Modular Micro-Kernel / Clean Architecture&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💬 I'd Love Your Feedback!
&lt;/h2&gt;

&lt;p&gt;This project has been an incredible journey in push-to-the-limit software engineering using modern PHP. &lt;/p&gt;

&lt;p&gt;I would absolutely love to hear the community's thoughts on this architecture:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What do you think about bringing the &lt;strong&gt;Ring 0 / Ring 3&lt;/strong&gt; security mindset into a web application platform?&lt;/li&gt;
&lt;li&gt;How are you setting up your architecture rules to prevent AI coding tools from breaking your design patterns?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Check out the repository, read the docs, and feel free to roast or praise the code:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/hadelrachid/domain-system" rel="noopener noreferrer"&gt;GitHub: hadelrachid/domain-system&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>opensource</category>
      <category>php</category>
    </item>
  </channel>
</rss>
