From 8cf9bd2b91c955dd7f3db5c0763227583a368fe1 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 14 May 2024 12:00:43 +0200 Subject: [PATCH 1/2] Adding support for Nette Framework. --- .../Drivers/Specific/NetteValetDriver.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 cli/Valet/Drivers/Specific/NetteValetDriver.php diff --git a/cli/Valet/Drivers/Specific/NetteValetDriver.php b/cli/Valet/Drivers/Specific/NetteValetDriver.php new file mode 100644 index 000000000..b245d5fa0 --- /dev/null +++ b/cli/Valet/Drivers/Specific/NetteValetDriver.php @@ -0,0 +1,41 @@ +isActualFile($staticFilePath = $sitePath.'/www/'.$uri)) { + return $staticFilePath; + } + + return false; + } + + /** + * Get the fully resolved path to the application's front controller. + */ + public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string + { + $_SERVER['DOCUMENT_ROOT'] = $sitePath.'/www'; + $_SERVER['SCRIPT_FILENAME'] = $sitePath.'/www/index.php'; + $_SERVER['SCRIPT_NAME'] = '/index.php'; + $_SERVER['PHP_SELF'] = '/index.php'; + + return $sitePath.'/www/index.php'; + } +} From 4a43ab03dbd51f861bd4445581251287a2fa781e Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 1 Jun 2024 14:57:23 +0200 Subject: [PATCH 2/2] Updated serves method to better determine that it's actually nette project. --- cli/Valet/Drivers/Specific/NetteValetDriver.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/Valet/Drivers/Specific/NetteValetDriver.php b/cli/Valet/Drivers/Specific/NetteValetDriver.php index b245d5fa0..1207d1625 100644 --- a/cli/Valet/Drivers/Specific/NetteValetDriver.php +++ b/cli/Valet/Drivers/Specific/NetteValetDriver.php @@ -11,7 +11,10 @@ class NetteValetDriver extends ValetDriver */ public function serves(string $sitePath, string $siteName, string $uri): bool { - return file_exists($sitePath.'/www'); + return file_exists($sitePath.'/www/index.php') + && file_exists($sitePath.'/www/.htaccess') + && file_exists($sitePath.'/config/common.neon') + && file_exists($sitePath.'/config/services.neon'); } /**