# bilalbutt/php-dos architecture

> Architecture diagram of the GitHub repository bilalbutt/php-dos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bilalbutt/php-dos
- Repository: https://github.com/bilalbutt/php-dos

## Overview

PHP DOS is a browser-based DOS-command simulator: a user enters a command, the client submits it asynchronously, PHP dispatches supported commands, and command handlers produce console-style output. The map separates the browser interface, dispatch and command behavior, help content, and shared configuration/helpers. The README documents the limited-command scope; the sampled dispatcher shows handler routing. The client-to-endpoint handoff is implied by the product description and filenames, but its exact request wiring was not excerpted.

Main entry points: [`ajax_php.php`](https://github.com/bilalbutt/php-dos/blob/main/ajax_php.php) (PHP dispatcher), [`index.php`](https://github.com/bilalbutt/php-dos/blob/main/index.php) (Terminal page), [`config.php`](https://github.com/bilalbutt/php-dos/blob/main/config.php) (Runtime settings), [`cmds/type.php`](https://github.com/bilalbutt/php-dos/blob/main/cmds/type.php) (TYPE command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Browser interface"]
  node_terminal["Terminal page<br/>[index.php]"]
  node_ajax["AJAX client<br/>[ajax.js]"]
end

subgraph group_dispatch["Command dispatch"]
  node_dispatcher["PHP dispatcher<br/>[ajax_php.php]"]
end

subgraph group_commands["Command handlers"]
  node_directory["DIR listing<br/>[dir.php]"]
  node_helpcmd["HELP command<br/>[help.php]"]
  node_about["ABOUT command<br/>[about.php]"]
  node_cd["CD command<br/>[cd.php]"]
  node_chdir["CHDIR command<br/>[chdir.php]"]
  node_color["COLOR command<br/>[color.php]"]
  node_date["DATE command<br/>[date.php]"]
  node_delete["DEL command<br/>[del.php]"]
  node_mkdir["MD command<br/>[md.php]"]
  node_rename["REN command<br/>[ren.php]"]
  node_type["TYPE command<br/>[type.php]"]
  node_time["TIME command<br/>[time.php]"]
  node_version["VER command<br/>[ver.php]"]
end

subgraph group_support["Configuration and help"]
  node_config["Runtime settings<br/>[config.php]"]
  node_defines["App constants<br/>[defines.php]"]
  node_functions["Shared helpers<br/>[functions.php]"]
  node_helpfiles["Command help text<br/>[chdir.php]"]
end

node_user(("Command user"))

node_user -->|"enters command"| node_terminal
node_terminal -->|"loads script"| node_ajax
node_ajax -.->|"submits command"| node_dispatcher
node_dispatcher -->|"loads settings"| node_config
node_dispatcher -->|"loads constants"| node_defines
node_dispatcher -->|"loads helpers"| node_functions
node_dispatcher -->|"dispatches DIR"| node_directory
node_dispatcher -->|"dispatches HELP"| node_helpcmd
node_dispatcher -->|"dispatches ABOUT"| node_about
node_dispatcher -->|"dispatches CD"| node_cd
node_dispatcher -->|"dispatches CHDIR"| node_chdir
node_dispatcher -->|"dispatches COLOR"| node_color
node_dispatcher -->|"dispatches DATE"| node_date
node_dispatcher -->|"dispatches DEL"| node_delete
node_dispatcher -->|"dispatches MD"| node_mkdir
node_dispatcher -->|"dispatches REN"| node_rename
node_dispatcher -->|"dispatches TYPE"| node_type
node_dispatcher -->|"dispatches TIME"| node_time
node_dispatcher -->|"dispatches VER"| node_version
node_terminal -->|"loads settings"| node_config
node_terminal -->|"loads constants"| node_defines
node_terminal -->|"loads helpers"| node_functions
node_directory -->|"reads settings"| node_config
node_type -->|"reads settings"| node_config
node_type -->|"uses file reader"| node_functions
node_helpcmd -->|"includes help text"| node_helpfiles

click node_terminal "https://github.com/bilalbutt/php-dos/blob/main/index.php"
click node_ajax "https://github.com/bilalbutt/php-dos/blob/main/js/ajax.js"
click node_dispatcher "https://github.com/bilalbutt/php-dos/blob/main/ajax_php.php"
click node_directory "https://github.com/bilalbutt/php-dos/blob/main/cmds/dir.php"
click node_helpcmd "https://github.com/bilalbutt/php-dos/blob/main/cmds/help.php"
click node_about "https://github.com/bilalbutt/php-dos/blob/main/cmds/about.php"
click node_cd "https://github.com/bilalbutt/php-dos/blob/main/cmds/cd.php"
click node_chdir "https://github.com/bilalbutt/php-dos/blob/main/cmds/chdir.php"
click node_color "https://github.com/bilalbutt/php-dos/blob/main/cmds/color.php"
click node_date "https://github.com/bilalbutt/php-dos/blob/main/cmds/date.php"
click node_delete "https://github.com/bilalbutt/php-dos/blob/main/cmds/del.php"
click node_mkdir "https://github.com/bilalbutt/php-dos/blob/main/cmds/md.php"
click node_rename "https://github.com/bilalbutt/php-dos/blob/main/cmds/ren.php"
click node_type "https://github.com/bilalbutt/php-dos/blob/main/cmds/type.php"
click node_time "https://github.com/bilalbutt/php-dos/blob/main/cmds/time.php"
click node_version "https://github.com/bilalbutt/php-dos/blob/main/cmds/ver.php"
click node_config "https://github.com/bilalbutt/php-dos/blob/main/config.php"
click node_defines "https://github.com/bilalbutt/php-dos/blob/main/defines.php"
click node_functions "https://github.com/bilalbutt/php-dos/blob/main/functions.php"
click node_helpfiles "https://github.com/bilalbutt/php-dos/blob/main/cmds/help/chdir.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_terminal,node_ajax,node_user toneBlue
class node_dispatcher toneAmber
class node_directory,node_helpcmd,node_about,node_cd,node_chdir,node_color,node_date,node_delete,node_mkdir,node_rename,node_type,node_time,node_version toneMint
class node_config,node_defines,node_functions,node_helpfiles toneRose
```

## Components

### Browser interface

- [Terminal page](https://github.com/bilalbutt/php-dos/blob/main/index.php): `index.php`
- [AJAX client](https://github.com/bilalbutt/php-dos/blob/main/js/ajax.js): `js/ajax.js`

### Command dispatch

- [PHP dispatcher](https://github.com/bilalbutt/php-dos/blob/main/ajax_php.php): `ajax_php.php`

### Command handlers

- [DIR listing](https://github.com/bilalbutt/php-dos/blob/main/cmds/dir.php): `cmds/dir.php`
- [HELP command](https://github.com/bilalbutt/php-dos/blob/main/cmds/help.php): `cmds/help.php`
- [ABOUT command](https://github.com/bilalbutt/php-dos/blob/main/cmds/about.php): `cmds/about.php`
- [CD command](https://github.com/bilalbutt/php-dos/blob/main/cmds/cd.php): `cmds/cd.php`
- [CHDIR command](https://github.com/bilalbutt/php-dos/blob/main/cmds/chdir.php): `cmds/chdir.php`
- [COLOR command](https://github.com/bilalbutt/php-dos/blob/main/cmds/color.php): `cmds/color.php`
- [DATE command](https://github.com/bilalbutt/php-dos/blob/main/cmds/date.php): `cmds/date.php`
- [DEL command](https://github.com/bilalbutt/php-dos/blob/main/cmds/del.php): `cmds/del.php`
- [MD command](https://github.com/bilalbutt/php-dos/blob/main/cmds/md.php): `cmds/md.php`
- [REN command](https://github.com/bilalbutt/php-dos/blob/main/cmds/ren.php): `cmds/ren.php`
- [TYPE command](https://github.com/bilalbutt/php-dos/blob/main/cmds/type.php): `cmds/type.php`
- [TIME command](https://github.com/bilalbutt/php-dos/blob/main/cmds/time.php): `cmds/time.php`
- [VER command](https://github.com/bilalbutt/php-dos/blob/main/cmds/ver.php): `cmds/ver.php`

### Configuration and help

- [Runtime settings](https://github.com/bilalbutt/php-dos/blob/main/config.php): `config.php`
- [App constants](https://github.com/bilalbutt/php-dos/blob/main/defines.php): `defines.php`
- [Shared helpers](https://github.com/bilalbutt/php-dos/blob/main/functions.php): `functions.php`
- [Command help text](https://github.com/bilalbutt/php-dos/blob/main/cmds/help/chdir.php): `cmds/help/chdir.php`

### Other components

- **Command user**

## Connections

- Command user → Terminal page: enters command (evidence: `index.php`)
- Terminal page → AJAX client: loads script (evidence: `index.php`)
- AJAX client → PHP dispatcher: submits command
- PHP dispatcher → Runtime settings: loads settings (evidence: `ajax_php.php`)
- PHP dispatcher → App constants: loads constants (evidence: `ajax_php.php`)
- PHP dispatcher → Shared helpers: loads helpers (evidence: `ajax_php.php`)
- PHP dispatcher → DIR listing: dispatches DIR (evidence: `ajax_php.php`)
- PHP dispatcher → HELP command: dispatches HELP (evidence: `ajax_php.php`)
- PHP dispatcher → ABOUT command: dispatches ABOUT (evidence: `ajax_php.php`)
- PHP dispatcher → CD command: dispatches CD (evidence: `ajax_php.php`)
- PHP dispatcher → CHDIR command: dispatches CHDIR (evidence: `ajax_php.php`)
- PHP dispatcher → COLOR command: dispatches COLOR (evidence: `ajax_php.php`)
- PHP dispatcher → DATE command: dispatches DATE (evidence: `ajax_php.php`)
- PHP dispatcher → DEL command: dispatches DEL (evidence: `ajax_php.php`)
- PHP dispatcher → MD command: dispatches MD (evidence: `ajax_php.php`)
- PHP dispatcher → REN command: dispatches REN (evidence: `ajax_php.php`)
- PHP dispatcher → TYPE command: dispatches TYPE (evidence: `ajax_php.php`)
- PHP dispatcher → TIME command: dispatches TIME (evidence: `ajax_php.php`)
- PHP dispatcher → VER command: dispatches VER (evidence: `ajax_php.php`)
- Terminal page → Runtime settings: loads settings (evidence: `index.php`)
- Terminal page → App constants: loads constants (evidence: `index.php`)
- Terminal page → Shared helpers: loads helpers (evidence: `index.php`)
- DIR listing → Runtime settings: reads settings (evidence: `cmds/dir.php`)
- TYPE command → Runtime settings: reads settings (evidence: `cmds/type.php`)
- TYPE command → Shared helpers: uses file reader (evidence: `cmds/type.php`)
- HELP command → Command help text: includes help text (evidence: `cmds/help.php`)
