Skip to content

feat(dev-server): Allow overriding host for dev server up#11

Open
renanmedina wants to merge 3 commits intomarko-php:developfrom
renanmedina:feat/allow-override-dev-server-host
Open

feat(dev-server): Allow overriding host for dev server up#11
renanmedina wants to merge 3 commits intomarko-php:developfrom
renanmedina:feat/allow-override-dev-server-host

Conversation

@renanmedina
Copy link
Copy Markdown

@renanmedina renanmedina commented Apr 3, 2026

📋 Overview

This pull request lets the PHP built-in server used by dev:up bind to a configurable host (default localhost), with optional overrides via --host / -h, matching how port is already configurable. It is intended for environments where listening only on localhost is not enough (for example, access from another interface or container).

Related

#9

🎯 Key Changes

Default host in dev config

  • Published dev.host in packages/dev-server/config/dev.php with default localhost so projects can override it in their own config.

dev:up command behavior

  • Resolves bind address from CLI (--host, -h) first, then dev.host from config.
  • Builds php -S with that host and port; startup message reflects the same host and port.

Tests

  • Default fake config includes dev.host.
  • Adds coverage for reading host from config (dev.host).

📝 Technical Details

File Change
packages/dev-server/config/dev.php Added host key defaulting to localhost.
packages/dev-server/src/Command/DevUpCommand.php Resolve $host from input and config; use it in php -S and in the user-facing startup line.
packages/dev-server/tests/Command/DevUpCommandTest.php Default dev.host in test helper; new test asserting php -S uses configured host.

✅ Testing

  • Run ./vendor/bin/pest packages/dev-server/tests/Command/DevUpCommandTest.php (or full suite with ./vendor/bin/pest --parallel).
  • Manually run marko dev:up (or marko up) with --host=0.0.0.0 and confirm the process listens on the expected address.

🚀 Deployment Notes

  • No deployment or migration steps. Existing installs keep behavior equivalent to the previous hardcoded localhost unless they set dev.host or pass --host / -h.

@github-actions github-actions bot added the enhancement New feature or request label Apr 3, 2026
@renanmedina renanmedina force-pushed the feat/allow-override-dev-server-host branch from 95a94da to 010ba9d Compare April 3, 2026 23:45
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant