ndev-stack 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. ndev_stack-0.1.0/PKG-INFO +553 -0
  2. ndev_stack-0.1.0/README.md +532 -0
  3. ndev_stack-0.1.0/ndev/__init__.py +8 -0
  4. ndev_stack-0.1.0/ndev/__main__.py +4 -0
  5. ndev_stack-0.1.0/ndev/cli.py +24 -0
  6. ndev_stack-0.1.0/ndev/common/__init__.py +3 -0
  7. ndev_stack-0.1.0/ndev/common/config.py +114 -0
  8. ndev_stack-0.1.0/ndev/common/constants.py +51 -0
  9. ndev_stack-0.1.0/ndev/common/github.py +13 -0
  10. ndev_stack-0.1.0/ndev/common/logger.py +11 -0
  11. ndev_stack-0.1.0/ndev/common/manifest.py +41 -0
  12. ndev_stack-0.1.0/ndev/common/utils.py +96 -0
  13. ndev_stack-0.1.0/ndev/linux/__init__.py +1 -0
  14. ndev_stack-0.1.0/ndev/linux/chroot/manager.py +63 -0
  15. ndev_stack-0.1.0/ndev/linux/chroot/packages.py +91 -0
  16. ndev_stack-0.1.0/ndev/linux/chroot/shell.py +9 -0
  17. ndev_stack-0.1.0/ndev/linux/cli.py +235 -0
  18. ndev_stack-0.1.0/ndev/linux/commands/available.py +38 -0
  19. ndev_stack-0.1.0/ndev/linux/commands/clean.py +25 -0
  20. ndev_stack-0.1.0/ndev/linux/commands/ctl.py +192 -0
  21. ndev_stack-0.1.0/ndev/linux/commands/current.py +11 -0
  22. ndev_stack-0.1.0/ndev/linux/commands/db.py +319 -0
  23. ndev_stack-0.1.0/ndev/linux/commands/doctor.py +56 -0
  24. ndev_stack-0.1.0/ndev/linux/commands/grok.py +75 -0
  25. ndev_stack-0.1.0/ndev/linux/commands/install.py +39 -0
  26. ndev_stack-0.1.0/ndev/linux/commands/list.py +47 -0
  27. ndev_stack-0.1.0/ndev/linux/commands/logs.py +36 -0
  28. ndev_stack-0.1.0/ndev/linux/commands/mailpit.py +82 -0
  29. ndev_stack-0.1.0/ndev/linux/commands/reload.py +26 -0
  30. ndev_stack-0.1.0/ndev/linux/commands/restart.py +34 -0
  31. ndev_stack-0.1.0/ndev/linux/commands/setup.py +113 -0
  32. ndev_stack-0.1.0/ndev/linux/commands/start.py +34 -0
  33. ndev_stack-0.1.0/ndev/linux/commands/status.py +81 -0
  34. ndev_stack-0.1.0/ndev/linux/commands/stop.py +34 -0
  35. ndev_stack-0.1.0/ndev/linux/commands/uninstall.py +69 -0
  36. ndev_stack-0.1.0/ndev/linux/commands/update.py +57 -0
  37. ndev_stack-0.1.0/ndev/linux/commands/upgrade.py +81 -0
  38. ndev_stack-0.1.0/ndev/linux/commands/use.py +108 -0
  39. ndev_stack-0.1.0/ndev/linux/commands/vhost.py +350 -0
  40. ndev_stack-0.1.0/ndev/linux/php/builder.py +183 -0
  41. ndev_stack-0.1.0/ndev/linux/php/downloader.py +58 -0
  42. ndev_stack-0.1.0/ndev/linux/php/extensions.py +146 -0
  43. ndev_stack-0.1.0/ndev/linux/php/installer.py +42 -0
  44. ndev_stack-0.1.0/ndev/linux/php/resolver.py +59 -0
  45. ndev_stack-0.1.0/ndev/linux/php/templates.py +128 -0
  46. ndev_stack-0.1.0/ndev/linux/runtime/fpm.py +117 -0
  47. ndev_stack-0.1.0/ndev/linux/runtime/mailpit.py +244 -0
  48. ndev_stack-0.1.0/ndev/linux/runtime/pma.py +223 -0
  49. ndev_stack-0.1.0/ndev/linux/runtime/process.py +37 -0
  50. ndev_stack-0.1.0/ndev/linux/runtime/sockets.py +16 -0
  51. ndev_stack-0.1.0/ndev/linux/runtime/upgrade.py +431 -0
  52. ndev_stack-0.1.0/ndev/linux/tui.py +1423 -0
  53. ndev_stack-0.1.0/ndev/main.py +52 -0
  54. ndev_stack-0.1.0/ndev/tui.py +23 -0
  55. ndev_stack-0.1.0/ndev/win/__init__.py +1 -0
  56. ndev_stack-0.1.0/ndev/win/cli.py +1898 -0
  57. ndev_stack-0.1.0/ndev/win/commands/__init__.py +0 -0
  58. ndev_stack-0.1.0/ndev/win/core/__init__.py +0 -0
  59. ndev_stack-0.1.0/ndev/win/core/db.py +265 -0
  60. ndev_stack-0.1.0/ndev/win/core/elevate.py +94 -0
  61. ndev_stack-0.1.0/ndev/win/core/ext.py +241 -0
  62. ndev_stack-0.1.0/ndev/win/core/fcgi.py +216 -0
  63. ndev_stack-0.1.0/ndev/win/core/grok.py +55 -0
  64. ndev_stack-0.1.0/ndev/win/core/logs.py +66 -0
  65. ndev_stack-0.1.0/ndev/win/core/mailpit.py +236 -0
  66. ndev_stack-0.1.0/ndev/win/core/mkcert.py +65 -0
  67. ndev_stack-0.1.0/ndev/win/core/paths.py +85 -0
  68. ndev_stack-0.1.0/ndev/win/core/php.py +533 -0
  69. ndev_stack-0.1.0/ndev/win/core/pma.py +190 -0
  70. ndev_stack-0.1.0/ndev/win/core/services.py +349 -0
  71. ndev_stack-0.1.0/ndev/win/core/setup.py +361 -0
  72. ndev_stack-0.1.0/ndev/win/core/upgrade.py +513 -0
  73. ndev_stack-0.1.0/ndev/win/core/vhost.py +289 -0
  74. ndev_stack-0.1.0/ndev/win/templates/vhost.conf.tmpl +33 -0
  75. ndev_stack-0.1.0/ndev/win/templates/vhost_ssl.conf.tmpl +43 -0
  76. ndev_stack-0.1.0/ndev/win/tui.py +1313 -0
  77. ndev_stack-0.1.0/ndev_stack.egg-info/PKG-INFO +553 -0
  78. ndev_stack-0.1.0/ndev_stack.egg-info/SOURCES.txt +82 -0
  79. ndev_stack-0.1.0/ndev_stack.egg-info/dependency_links.txt +1 -0
  80. ndev_stack-0.1.0/ndev_stack.egg-info/entry_points.txt +4 -0
  81. ndev_stack-0.1.0/ndev_stack.egg-info/requires.txt +8 -0
  82. ndev_stack-0.1.0/ndev_stack.egg-info/top_level.txt +1 -0
  83. ndev_stack-0.1.0/pyproject.toml +44 -0
  84. ndev_stack-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,553 @@
1
+ Metadata-Version: 2.4
2
+ Name: ndev-stack
3
+ Version: 0.1.0
4
+ Summary: Cross-platform developer stack manager for PHP, FastCGI/PHP-FPM, MariaDB, Nginx, SSL, and Mailpit on Linux and Windows
5
+ Author-email: Ankit Karan <ankit.karan99@gmail.com>
6
+ Project-URL: Homepage, https://github.com/ankitkaran99/ndev
7
+ Project-URL: Repository, https://github.com/ankitkaran99/ndev
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: click>=8.1.0
14
+ Requires-Dist: typer>=0.9.0
15
+ Requires-Dist: rich>=13.0.0
16
+ Requires-Dist: textual>=0.40.0
17
+ Requires-Dist: httpx>=0.24.0
18
+ Requires-Dist: filelock>=3.12.0
19
+ Requires-Dist: packaging>=23.0
20
+ Requires-Dist: jinja2>=3.1.0
21
+
22
+ # ndev
23
+
24
+ `ndev` is a powerful, non-root / non-admin developer tool suite to manage, run, and isolate PHP runtimes (PHP-FPM on Linux, FastCGI worker pools on Windows), PECL extensions, MySQL/MariaDB databases, Nginx virtual hosts, trusted local SSL certificates, Mailpit email sandbox, and public HTTP tunneling natively on **Linux** (Debian/Ubuntu) and **Windows 10/11**.
25
+
26
+ A single unified repository and package with automatic OS detection that uses native operating system primitives for each platform.
27
+
28
+ <p align="center">
29
+ <img src="ui.PNG" alt="ndev Interactive TUI Dashboard" width="850">
30
+ </p>
31
+
32
+ ---
33
+
34
+ ## Key Features
35
+
36
+ - **Multi-Version PHP Management**:
37
+ - **Linux**: Sandboxed source compilation (`5.6` – `8.5`) inside an unprivileged `bubblewrap` environment with custom, self-healing multiarch paths.
38
+ - **Windows**: Instant zero-compilation prebuilt official binaries from `windows.php.net` (NTS & TS, x64 & x86).
39
+ - **Process & Daemon Model**:
40
+ - **Linux**: Isolated native `php-fpm` worker pools communicating over Unix domain sockets (`~/.ndev/run/php<ver>.sock`).
41
+ - **Windows**: Deterministic multi-process `php-cgi.exe` FastCGI worker pools load-balanced by Nginx `upstream` blocks.
42
+ - **Interactive Terminal UI Dashboard (`ui` / `tui` / `dashboard`)**: Modern, asynchronous Textual TUI dashboard for real-time stack monitoring, live auto-refresh, quick batch actions (Start/Stop/Restart All), active CLI PHP switching, integrated log tailing, and virtual host launching.
43
+ - **Interactive Control Menu (`ctl`)**: Unified terminal service selector to monitor and control Nginx, MariaDB, phpMyAdmin, and PHP instances.
44
+ - **Nginx Virtual Host Manager (`vhost`)**: Automated Nginx server blocks with custom upstreams, canonical HTTP $\rightarrow$ HTTPS redirects, trusted local SSL certificate generation (`mkcert`), and `/etc/hosts` / Windows `hosts` mapping.
45
+ - **SQL Database Manager (`db`)**: Interactive wizard and CLI suite to create/drop databases, manage users, grant permissions, and export SQL dumps (`mysqldump`).
46
+ - **PECL Extension Manager (`ext`)**: Compiles or downloads precompiled PECL `.dll` / `.so` binaries (Redis, Xdebug, etc.) and enables/disables them per PHP version.
47
+ - **Local Email Sandbox (`mailpit`)**: Zero-dependency local SMTP email catcher & modern web UI (`http://127.0.0.1:8025`) using prebuilt binaries.
48
+ - **phpMyAdmin Background Service (`pma`)**: One-command background phpMyAdmin service management served locally over `http://127.0.0.1:8080`.
49
+ - **Public HTTP Tunneling (`grok`)**: Interactive ngrok tunnel launcher to proxy local virtual hosts over the web with automatic Host header rewriting.
50
+ - **Automated Stack Setup (`setup`)**:
51
+ - **Linux**: Installs MariaDB, Nginx, Composer, and creates symlinks in `~/.local/bin/`.
52
+ - **Windows**: Portable zero-installer extraction of Nginx, MariaDB, mkcert, ngrok, Mailpit, Composer, and CA bundles under `%USERPROFILE%\.ndev\` with global batch shims on `PATH`.
53
+
54
+ ---
55
+
56
+ ## Platform Differences: Linux (`ndev`) vs. Windows (`ndev`)
57
+
58
+ | Subsystem | Linux (`ndev`) | Windows (`ndev`) |
59
+ | :--- | :--- | :--- |
60
+ | **PHP Distribution** | Compiles PHP from official source using `bubblewrap` sandbox and `gcc`/`make` | Downloads official precompiled Windows builds from `windows.php.net` (NTS & TS, x64 & x86) |
61
+ | **Process Model** | Native `php-fpm` daemon with Unix domain sockets (`~/.ndev/run/php<ver>.sock`) | Multi-process worker pool of `php-cgi.exe` instances over deterministic TCP ports (`13000+`), balanced via Nginx `upstream` |
62
+ | **CLI & PATH Switching** | Linux symlinks in `~/.local/bin/` (`php`, `composer`, `ndev`) pointing to `~/.ndev/current/` | Windows batch shims in `%USERPROFILE%\.ndev\shims\` (`php.bat`, `composer.bat`, `ndev.bat`) |
63
+ | **Privilege Elevation** | `sudo` for Nginx and `/etc/hosts` changes | Scoped Windows UAC elevation via Win32 `ShellExecuteExW` (`runas`) only when updating `hosts` file |
64
+ | **Web Server** | Host system package installed via `apt install nginx` (`/etc/nginx/`) | Portable standalone Nginx zip extracted to `%USERPROFILE%\.ndev\nginx\` |
65
+ | **Database** | Host system package installed via `apt install mariadb-server` | Portable MariaDB zip extracted to `%USERPROFILE%\.ndev\mariadb\` initialized via `mariadb-install-db.exe` |
66
+ | **PECL Extensions** | Source compilation (`phpize`, `./configure`, `make`) within build sandbox | Precompiled official PECL `.dll` downloads matching PHP version, VS compiler (`vs16`, `vs17`), and thread safety |
67
+ | **Email Sandbox** | Prebuilt Linux Mailpit binary in `~/.ndev/bin/mailpit` | Prebuilt Windows Mailpit binary in `%USERPROFILE%\.ndev\shims\mailpit.exe` |
68
+ | **phpMyAdmin** | Served via PHP's built-in web server (`php -S 127.0.0.1:8080`) | Served via PHP's built-in web server (`php.exe -S 127.0.0.1:8080`) |
69
+ | **Local SSL** | `mkcert` package via `apt` (`~/.ndev/certs/`) | Portable `mkcert.exe` downloaded into `%USERPROFILE%\.ndev\shims\` |
70
+ | **TUI Dashboard** | Asynchronous Textual TUI (`ndev ui`) with live auto-refresh | Asynchronous Textual TUI (`ndev ui`) with live auto-refresh |
71
+
72
+ ---
73
+
74
+ ## Codebase Architecture
75
+
76
+ ```text
77
+ ndev/
78
+ ├── main.py # Main entrypoint & automatic OS dispatcher
79
+ ├── cli.py # CLI redirect to ndev.main
80
+ ├── tui.py # TUI redirect to ndev.win.tui or ndev.linux.tui
81
+ ├── common/ # Cross-platform shared utilities
82
+ │ ├── constants.py # Shared directory constants and defaults
83
+ │ ├── logger.py # Rich logging engine
84
+ │ ├── config.py # Configuration schema and loader
85
+ │ ├── github.py # GitHub release query APIs
86
+ │ ├── manifest.py # Build manifest and package index
87
+ │ └── utils.py # Shared system & network helper functions
88
+ ├── win/ # Windows native subsystem
89
+ │ ├── cli.py # Windows Click CLI command suite
90
+ │ ├── tui.py # Windows Textual TUI Dashboard & Modals
91
+ │ ├── core/ # Windows core modules (paths, php, fcgi, services, vhost, mkcert, db, pma, mailpit, setup, upgrade)
92
+ │ └── templates/ # Nginx virtual host configuration templates
93
+ └── linux/ # Linux native subsystem
94
+ ├── cli.py # Linux Typer CLI command suite
95
+ ├── tui.py # Linux Textual TUI Dashboard & Modals
96
+ ├── commands/ # Linux CLI sub-commands (start, stop, vhost, ctl, etc.)
97
+ ├── runtime/ # Linux daemon runners (fpm, pma, mailpit, process, upgrade)
98
+ ├── php/ # Linux PHP source compilation & resolver
99
+ └── chroot/ # Unprivileged bubblewrap sandbox manager
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Directory Structure & Layout
105
+
106
+ ### Linux Layout (`~/.ndev`)
107
+ ```text
108
+ ~/.ndev/
109
+ ├── bin/ # Standalone binaries (mailpit)
110
+ ├── builds/ # Source tarballs and compilation build directories
111
+ ├── cache/ # Download and build cache
112
+ ├── certs/ # Local SSL certificates and mkcert root CA
113
+ ├── chroot/ # Sandboxed development packages and build root
114
+ ├── downloads/ # Downloaded source archives
115
+ ├── logs/ # Service and daemon logs (pma.log, mailpit.log, etc.)
116
+ ├── php/
117
+ │ └── <version>/ # Compiled PHP installations (bin/, sbin/, etc/php.ini, etc/php-fpm.d/)
118
+ ├── phpmyadmin/ # Standalone phpMyAdmin installation & config.inc.php
119
+ ├── run/ # Active PID and Unix domain socket files (*.sock, *.pid)
120
+ ├── current # Symlink pointing to the currently active PHP version directory
121
+ ├── mailpit.db # Persistent message database for Mailpit
122
+ └── config.toml # Global build and runtime configuration
123
+ ```
124
+
125
+ ### Windows Layout (`%USERPROFILE%\.ndev`)
126
+ ```text
127
+ %USERPROFILE%\.ndev\
128
+ ├── certs\ # Local SSL certificates and cacert.pem CA bundle
129
+ ├── downloads\ # Cached zip downloads
130
+ ├── mariadb\ # Portable MariaDB installation & data directory
131
+ │ ├── bin\ # mysqld.exe, mysql.exe, mysqldump.exe
132
+ │ └── data\ # Database storage
133
+ ├── nginx\ # Portable Nginx installation
134
+ │ ├── conf\
135
+ │ │ ├── nginx.conf # Main Nginx config (patches include ndev-vhosts/*.conf)
136
+ │ │ └── ndev-vhosts\ # Virtual host configurations (*.conf)
137
+ │ ├── logs\ # Nginx access/error logs per virtual host
138
+ │ └── temp\ # FastCGI and proxy client temporary body storage
139
+ ├── php\
140
+ │ └── <version>\ # Extracted PHP binaries (php.exe, php-cgi.exe, php.ini, ext/)
141
+ ├── pma\ # Standalone phpMyAdmin installation & config.inc.php
142
+ ├── run\ # Active PID and FastCGI worker state files (JSON)
143
+ ├── shims\ # Global batch shims for PATH (php, composer, mysql, mailpit, ndev, etc.)
144
+ ├── mailpit.db # Persistent message database for Mailpit
145
+ └── config.json # Global configuration (ports, worker counts)
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Installation
151
+
152
+ ### Standard Installation via PyPI
153
+
154
+ Install `ndev-stack` directly using `pip` or `pipx` (recommended for standalone CLI tools):
155
+
156
+ ```bash
157
+ # Using pip
158
+ pip install ndev-stack
159
+
160
+ # Or using pipx (isolated application environment)
161
+ pipx install ndev-stack
162
+ ```
163
+
164
+ > **Note**: The package is published on PyPI as `ndev-stack`, but installs the global commands `ndev`, `ndev-win`, and `ndev-linux`.
165
+
166
+ ---
167
+
168
+ ## Quick Start Guide
169
+
170
+ ### Windows 10 / 11
171
+
172
+ ```powershell
173
+ # 1. Install ndev
174
+ pip install ndev
175
+
176
+ # 2. Download and configure portable stack (Nginx, MariaDB, mkcert, Mailpit, Composer)
177
+ ndev setup
178
+
179
+ # 3. Add shims to user PATH (one-time setup for global CLI access)
180
+ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:USERPROFILE\.ndev\shims", "User")
181
+ $env:Path += ";$env:USERPROFILE\.ndev\shims"
182
+
183
+ # 4. Verify installation & launch interactive dashboard
184
+ ndev doctor
185
+ ndev ui
186
+ ```
187
+
188
+ ### Linux (Debian / Ubuntu)
189
+
190
+ ```bash
191
+ # 1. Install system build dependencies
192
+ sudo apt update
193
+ sudo apt install -y bubblewrap build-essential pkg-config nginx mkcert default-mysql-client
194
+ mkcert -install
195
+
196
+ # 2. Install ndev
197
+ pip install ndev
198
+
199
+ # 3. Bootstrap runtime environment and shims
200
+ ndev setup
201
+ export PATH="$HOME/.local/bin:$PATH"
202
+
203
+ # 4. Verify installation & launch interactive dashboard
204
+ ndev doctor
205
+ ndev ui
206
+ ```
207
+
208
+ ### Development / Source Installation
209
+
210
+ ```bash
211
+ git clone https://github.com/ankitkaran99/ndev.git
212
+ cd ndev
213
+ pip install -e .
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Quick Command Reference
219
+
220
+ | Command | Action |
221
+ |---|---|
222
+ | `ndev ui` | Launch real-time Textual TUI dashboard (*aliases: `tui`, `dashboard`*) |
223
+ | `ndev available` | List available PHP releases (`--archives` for legacy versions) |
224
+ | `ndev install <ver>` | Install / compile a PHP version (`8.4`, `8.3`, `7.4`) |
225
+ | `ndev use <ver>` | Switch active CLI PHP version on PATH |
226
+ | `ndev current` | Show active CLI PHP version |
227
+ | `ndev list` | List installed PHP versions and daemon / worker pool status |
228
+ | `ndev start <target>` | Start service or pool (`all`, `nginx`, `mariadb`, `pma`, `mailpit`, `<ver>`) |
229
+ | `ndev stop <target>` | Stop service or pool (`all`, `nginx`, `mariadb`, `pma`, `mailpit`, `<ver>`) |
230
+ | `ndev restart <target>`| Restart service or pool (`all`, `nginx`, `mariadb`, `pma`, `mailpit`, `<ver>`) |
231
+ | `ndev reload nginx` | Reload Nginx configuration without downtime |
232
+ | `ndev status` | View real-time service status dashboard |
233
+ | `ndev ctl` | Interactive terminal service control menu |
234
+ | `ndev vhost` | Interactive virtual host creation wizard with local SSL |
235
+ | `ndev vhost-list` | List all configured virtual hosts |
236
+ | `ndev vhost-remove` | Remove virtual host and clean up hosts file |
237
+ | `ndev db` | Interactive SQL database management wizard |
238
+ | `ndev ext` | Manage PECL extensions (`list`, `install`, `enable`, `disable`) |
239
+ | `ndev mailpit` | Manage local email sandbox (`install`, `start`, `stop`, `launch`, `open`) |
240
+ | `ndev pma` | Manage phpMyAdmin background service (`http://127.0.0.1:8080`) |
241
+ | `ndev grok` | Public HTTP tunneling for local virtual hosts via ngrok |
242
+ | `ndev upgrade` | Check for and upgrade stack components (Nginx, Mailpit, MariaDB, PMA, mkcert, Composer) |
243
+ | `ndev upgrade --check` | Check component versions against upstream releases without upgrading |
244
+ | `ndev shell` | Interactive developer subshell pre-loaded with PHP/Composer/MySQL on PATH |
245
+ | `ndev doctor` | Run environment diagnostics and health checks |
246
+ | `ndev logs` | View and tail service and virtual host logs |
247
+ | `ndev clean` | Clean up downloads cache and stale runtime state |
248
+
249
+ ---
250
+
251
+ ## Usage Guide
252
+
253
+ ### PHP Version Management
254
+
255
+ ```bash
256
+ # List available PHP versions from php.net / windows.php.net
257
+ ndev available
258
+ ndev available --archives # include legacy releases
259
+
260
+ # Install a PHP version (compiled on Linux, downloaded on Windows)
261
+ ndev install 8.4
262
+
263
+ # List locally installed PHP versions and daemon/pool status
264
+ ndev list
265
+
266
+ # Switch globally active CLI PHP version
267
+ ndev use 8.4
268
+
269
+ # Show current active CLI PHP version
270
+ ndev current
271
+
272
+ # Check for newer minor/patch releases
273
+ ndev update
274
+
275
+ # Uninstall a PHP version
276
+ ndev uninstall 7.4
277
+ ```
278
+
279
+ ---
280
+
281
+ ### Process & Service Management
282
+
283
+ ```bash
284
+ # Start / Stop / Restart a PHP pool or service
285
+ ndev start 8.4
286
+ ndev stop 8.4
287
+ ndev restart 8.4
288
+
289
+ # Control Nginx, MariaDB, phpMyAdmin, or Mailpit
290
+ ndev start nginx
291
+ ndev start mariadb
292
+ ndev start pma
293
+ ndev start mailpit
294
+ ndev start all
295
+
296
+ # Stop or restart all services
297
+ ndev stop all
298
+ ndev restart all
299
+
300
+ # Reload Nginx configuration without downtime
301
+ ndev reload nginx
302
+
303
+ # View service status dashboard
304
+ ndev status
305
+ ndev status 8.4
306
+ ndev status pma
307
+ ndev status mailpit
308
+ ```
309
+
310
+ ---
311
+
312
+ ### Interactive Terminal UI Dashboard (`ui` / `dashboard`)
313
+
314
+ Launch the modern, responsive Textual TUI dashboard for real-time monitoring and process control:
315
+
316
+ ```bash
317
+ ndev ui
318
+ # Aliases: ndev tui, ndev dashboard
319
+ ```
320
+
321
+ * **Live Status Dashboard**: Real-time health, PIDs, sockets/ports for Nginx, MariaDB, PMA (phpMyAdmin), Mailpit, and all PHP instances.
322
+ * **One-Click Component Setup & Upgrades**: Install uninstalled services (**PMA**, **Mailpit**, **Nginx**, **MariaDB**, **mkcert**, **Composer**) or check/upgrade stack releases with single-click UI actions.
323
+ * **Interactive Virtual Host Manager**: Create new virtual hosts (`+ Create VHost`) with automatic mkcert SSL and docroot binding via modal dialog, or delete existing vhosts with full cleanup.
324
+ * **PHP Runtime Lifecycle**: Install new PHP runtimes (`+ Install PHP`) from upstream releases, uninstall versions (`✖ Uninstall Selected`), switch active CLI version, or start/stop individual FastCGI pools.
325
+ * **Quick Batch Actions**: One-click **Start All**, **Stop All**, **Restart All**, and **Reload Nginx** from the persistent sidebar.
326
+ * **On-the-fly CLI PHP Switcher**: Change globally active CLI PHP version instantly via dropdown.
327
+ * **Integrated Log Tail Viewer**: Select and inspect live tails for Nginx, MariaDB, PHP, and Virtual Host logs.
328
+ * **Asynchronous & Non-Blocking**: Built with Textual workers — all background actions and I/O polling run smoothly without freezing the UI.
329
+
330
+ ---
331
+
332
+ ### Interactive CLI Control Menu (`ctl`)
333
+
334
+ Launch the interactive terminal service selector:
335
+ ```bash
336
+ ndev ctl
337
+ ```
338
+
339
+ ---
340
+
341
+ ### Virtual Host Management (`vhost`)
342
+
343
+ Create and manage local Nginx sites mapped to `127.0.0.1`:
344
+
345
+ ```bash
346
+ # Interactive wizard
347
+ ndev vhost
348
+
349
+ # Create a standard HTTP virtual host
350
+ ndev vhost --domain project.local --root /path/to/project --php 8.4
351
+
352
+ # Create an HTTPS virtual host with trusted local SSL certificates (mkcert)
353
+ ndev vhost --domain project.local --root /path/to/project --php 8.4 --ssl
354
+
355
+ # List all configured virtual hosts
356
+ ndev vhost-list
357
+
358
+ # Remove a virtual host
359
+ ndev vhost-remove --domain project.local
360
+ ```
361
+
362
+ ---
363
+
364
+ ### SQL Database Manager (`db`)
365
+
366
+ Manage MySQL/MariaDB databases and users:
367
+
368
+ > [!TIP]
369
+ > **Default MariaDB / MySQL Credentials**:
370
+ > * **Host**: `127.0.0.1` or `localhost`
371
+ > * **Port**: `3306`
372
+ > * **Username**: `root`
373
+ > * **Password**: `root` (Windows) / system auth (Linux)
374
+
375
+ ```bash
376
+ # Launch interactive database wizard
377
+ ndev db
378
+
379
+ # Create a database
380
+ ndev db create-db mydb --owner myuser
381
+
382
+ # Create a database user with privileges
383
+ ndev db create-user myuser --new-password secret --grant-db mydb
384
+
385
+ # Export database dump
386
+ ndev db export-db mydb -o backup.sql
387
+
388
+ # Import database dump
389
+ ndev db import-db mydb backup.sql
390
+
391
+ # Drop a database
392
+ ndev db drop-db mydb
393
+ ```
394
+
395
+ ---
396
+
397
+ ### PECL Extension Manager (`ext`)
398
+
399
+ Manage PECL extensions for any installed PHP version:
400
+
401
+ ```bash
402
+ # List loaded extensions for a PHP version
403
+ ndev ext list 8.4
404
+
405
+ # Install a PECL extension (e.g. redis, xdebug)
406
+ ndev ext install redis 8.4
407
+
408
+ # Enable or disable an extension
409
+ ndev ext enable redis 8.4
410
+ ndev ext disable redis 8.4
411
+ ```
412
+
413
+ ---
414
+
415
+ ### phpMyAdmin Management (`pma`)
416
+
417
+ Manage the phpMyAdmin database administration web UI served locally in the background:
418
+
419
+ > [!TIP]
420
+ > **phpMyAdmin Access & Credentials**:
421
+ > * **URL**: [http://127.0.0.1:8080](http://127.0.0.1:8080)
422
+ > * **Default Username**: `root`
423
+
424
+ ```bash
425
+ # Start phpMyAdmin on port 8080 (auto-installs on first run)
426
+ ndev start pma
427
+
428
+ # Check status
429
+ ndev status pma
430
+
431
+ # Stop or restart phpMyAdmin
432
+ ndev stop pma
433
+ ndev restart pma
434
+ ```
435
+
436
+ ---
437
+
438
+ ### Local Email Sandbox (`mailpit`)
439
+
440
+ Catch every outgoing e-mail your local project sends without hitting real inboxes, using [Mailpit](https://github.com/axllent/mailpit) — a fast, zero-dependency prebuilt binary with a modern web UI.
441
+
442
+ > [!TIP]
443
+ > **SMTP & Web UI Defaults**:
444
+ > * **SMTP server** → `127.0.0.1:1025` ← point your PHP / Laravel / WordPress app here
445
+ > * **Web inbox** → [http://127.0.0.1:8025](http://127.0.0.1:8025)
446
+ > * No authentication required — every sent email is safely captured locally.
447
+
448
+ ```bash
449
+ # Install prebuilt binary from GitHub releases
450
+ ndev mailpit install
451
+
452
+ # Start the sandbox (auto-downloads if not present)
453
+ ndev mailpit start
454
+ ndev start mailpit
455
+
456
+ # Launch / open Web UI in your default browser
457
+ ndev mailpit launch
458
+ ndev mailpit open
459
+
460
+ # View status
461
+ ndev mailpit status
462
+ ndev status mailpit
463
+
464
+ # Stop or restart
465
+ ndev mailpit stop
466
+ ndev stop mailpit
467
+ ndev mailpit restart
468
+ ndev restart mailpit
469
+
470
+ # Custom ports
471
+ ndev mailpit start --smtp-port 2525 --web-port 8085
472
+ ```
473
+
474
+ #### Configuring your PHP project to use Mailpit
475
+
476
+ **Laravel (`.env`):**
477
+ ```env
478
+ MAIL_MAILER=smtp
479
+ MAIL_HOST=127.0.0.1
480
+ MAIL_PORT=1025
481
+ MAIL_USERNAME=null
482
+ MAIL_PASSWORD=null
483
+ MAIL_ENCRYPTION=null
484
+ ```
485
+
486
+ **Native PHP (`php.ini`):**
487
+ ```ini
488
+ [mail function]
489
+ SMTP = 127.0.0.1
490
+ smtp_port = 1025
491
+ ```
492
+
493
+ **WordPress (`wp-config.php` / SMTP Plugin):**
494
+ * **Host**: `127.0.0.1`
495
+ * **Port**: `1025`
496
+ * **Encryption**: None / Plain
497
+ * **Authentication**: None / No
498
+
499
+ Or via Symfony Mailer / PHPMailer / Python / Node.js — just send SMTP traffic to `127.0.0.1:1025`.
500
+
501
+ ---
502
+
503
+ ### Interactive Developer Shell (`shell`)
504
+
505
+ Open an interactive shell pre-configured with active PHP, Composer, MySQL, and Nginx on your `PATH`:
506
+
507
+ ```bash
508
+ ndev shell
509
+ ```
510
+
511
+ ---
512
+
513
+ ### Public HTTP Tunneling (`grok`)
514
+
515
+ Tunnel any configured local virtual host to the public web via `ngrok`:
516
+
517
+ ```bash
518
+ ndev grok
519
+ ```
520
+
521
+ ---
522
+
523
+ ### Diagnostics & Log Viewing
524
+
525
+ ```bash
526
+ # Run environment diagnostics
527
+ ndev doctor
528
+
529
+ # View / tail logs
530
+ ndev logs
531
+ ndev logs 8.4
532
+
533
+ # Clean download cache and temporary files
534
+ ndev clean
535
+ ```
536
+
537
+ ---
538
+
539
+ ## Configuration
540
+
541
+ ### Linux
542
+ * **Global Configuration**: `~/.ndev/config.toml`
543
+ * **PHP Configuration (`php.ini`)**: `~/.ndev/php/<version>/etc/php.ini`
544
+ * **Extension Configurations (`conf.d/`)**: `~/.ndev/php/<version>/etc/conf.d/<ext>.ini`
545
+ * **PHP-FPM Server Configuration**: `~/.ndev/php/<version>/etc/php-fpm.conf`
546
+ * **PHP-FPM Pool Configuration**: `~/.ndev/php/<version>/etc/php-fpm.d/www.conf`
547
+
548
+ ### Windows
549
+ * **Global Configuration**: `%USERPROFILE%\.ndev\config.json`
550
+ * **PHP Configuration (`php.ini`)**: `%USERPROFILE%\.ndev\php\<version>\php.ini`
551
+ * **Nginx Configuration**: `%USERPROFILE%\.ndev\nginx\conf\nginx.conf`
552
+ * **Virtual Host Configs**: `%USERPROFILE%\.ndev\nginx\conf\ndev-vhosts\*.conf`
553
+ * **FastCGI Worker Pools**: Configurable base port (default: `13000`) and workers per version (default: `4`) in `config.json`.