Add the possibility to bind ServeCommand to all interfaces - #871
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the ServeCommand developer server CLI to make it easier to bind to all network interfaces and to improve the startup output when running on a wildcard bind address.
Changes:
- Changed the default bind host from
127.0.0.1tolocalhost, and introducedLOOPBACK_HOSTS/WILDCARD_HOSTSconstants to classify hosts. - Added support for passing
--hostwithout a value to bind to all interfaces (intended to map to0.0.0.0). - When bound to a wildcard host, the command now prints “Remote address” URLs for detected local network IPv4 addresses.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
giuscris
force-pushed
the
feature/improved-serve-command
branch
from
August 19, 2026 12:18
ba9ca38 to
3dda92c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
formwork/src/Commands/ServeCommand.php:105
- The argv rewrite for
--hostwill also trigger when the user passes a host value as a separate argument (e.g.--host 127.0.0.1). In that case the code overwrites the option to0.0.0.0and leaves the original host value as a stray positional argument, which is likely to break CLImate parsing or produce unexpected behavior.
// --host without a value binds to all interfaces
foreach (array_keys($argv, '--host', true) as $key) {
$argv[$key] = '--host=0.0.0.0';
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the usability of the
ServeCommandby making it easier to bind the server to all network interfaces and providing clearer feedback when running in this mode. The changes also enhance the output by listing accessible remote addresses when the server is bound to a wildcard host.Usability improvements:
'127.0.0.1'to'localhost', and new constantsLOOPBACK_HOSTSandWILDCARD_HOSTShave been introduced to clarify host types.--hostto be passed without a value, causing the server to bind to all interfaces (0.0.0.0).Output enhancements:
getLocalNetworkIps()was added to retrieve local network IP addresses, excluding loopback interfaces.