feat: remove serveDirectory() — use serveFromDisk() for production#20
feat: remove serveDirectory() — use serveFromDisk() for production#20developersharif merged 1 commit intomainfrom
Conversation
Drop the PHP built-in web server approach (serveDirectory) that caused firewall prompts and port conflicts on consumer PCs. serveFromDisk() is the correct production method — no ports, no extra processes, uses native platform URI schemes (phpgui:// on Linux, virtual host on Windows, loadFileURL on macOS). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request removes the functionality to serve a directory via PHP's built-in web server from the WebView class, including the serveDirectory and getServerPort methods. Feedback indicates that these removals constitute a breaking change to the public API and will lead to fatal errors in the test suite, as existing tests still reference the deleted methods.
src/Widget/WebView.php
Outdated
| * @param string $path Path to the directory containing index.html | ||
| * @param int $port Port to use (0 = auto-pick a free port) | ||
| */ | ||
| public function serveDirectory(string $path, int $port = 0): void |
There was a problem hiding this comment.
Removing the public method serveDirectory() and its associated getter getServerPort() is a breaking change for the public API. More importantly, this removal will cause fatal errors in the test suite, as tests/webview/FrontendServingTest.php (specifically the suite starting at line 469) still references both methods. Please ensure the tests are updated or removed to reflect the new API before merging.
Drop the PHP built-in web server approach (serveDirectory) that caused firewall prompts and port conflicts on consumer PCs. serveFromDisk() is the correct production method — no ports, no extra processes, uses native platform URI schemes (phpgui:// on Linux, virtual host on Windows, loadFileURL on macOS).