Problem
Problem
The marko up command starts PHP's built-in server bound to localhost, which only listens on the loopback interface (127.0.0.1). Inside a devcontainer, port forwarding connects to the container's network interface — not its loopback — so requests from the host machine never reach the PHP server.
Proposed Solution
Solution
Added a configurable host option to the dev-server package.
Default config (vendor/marko/dev-server/config/dev.php):
- Added
'host' => 'localhost' — safe default for local development.
DevUpCommand (vendor/marko/dev-server/src/Command/DevUpCommand.php):
- Reads host from
--host CLI option or dev.host config key.
- Uses the configured host in the
php -S command instead of the hardcoded localhost.
App-level override (config/dev.php):
- Sets
'host' => '0.0.0.0' so the server listens on all interfaces inside the container.
Usage
For local development (no container), the default localhost binding works as before. For devcontainer environments, override in your app's config/dev.php:
return [
'host' => '0.0.0.0',
];
Or pass it as a CLI option:
Alternatives Considered
Unless, this is possible inside the framework already, I may have overlooked it.
Package
dev-server
Problem
Problem
The
marko upcommand starts PHP's built-in server bound tolocalhost, which only listens on the loopback interface (127.0.0.1). Inside a devcontainer, port forwarding connects to the container's network interface — not its loopback — so requests from the host machine never reach the PHP server.Proposed Solution
Solution
Added a configurable
hostoption to the dev-server package.Default config (
vendor/marko/dev-server/config/dev.php):'host' => 'localhost'— safe default for local development.DevUpCommand (
vendor/marko/dev-server/src/Command/DevUpCommand.php):--hostCLI option ordev.hostconfig key.php -Scommand instead of the hardcodedlocalhost.App-level override (
config/dev.php):'host' => '0.0.0.0'so the server listens on all interfaces inside the container.Usage
For local development (no container), the default
localhostbinding works as before. For devcontainer environments, override in your app'sconfig/dev.php:Or pass it as a CLI option:
Alternatives Considered
Unless, this is possible inside the framework already, I may have overlooked it.
Package
dev-server