From cda54e17ea9b7bdc38bfc0310506884ba3c1241f Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Sun, 27 Aug 2023 13:55:07 -0400 Subject: [PATCH] Allow LaravelValetDriver to serve other /public/*.php files When PHP files other than index.php exist in /public/ this allows them to be served by the Laravel driver. I discussed this previously at: https://github.com/laravel/valet/discussions/1430#discussioncomment-6536474 ... but I think it's safe to include in the core LaravelValetDriver by default. --- cli/Valet/Drivers/LaravelValetDriver.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/Valet/Drivers/LaravelValetDriver.php b/cli/Valet/Drivers/LaravelValetDriver.php index f5b8dedb4..22b576cc6 100644 --- a/cli/Valet/Drivers/LaravelValetDriver.php +++ b/cli/Valet/Drivers/LaravelValetDriver.php @@ -52,6 +52,11 @@ public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: */ public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string { + if (file_exists($staticFilePath = $sitePath.'/public'.$uri) + && $this->isActualFile($staticFilePath)) { + return $staticFilePath; + } + return $sitePath.'/public/index.php'; } }