Last active
January 24, 2023 02:30
-
-
Save houssenedao/1c58377e1609083d34e55c73fc67b5f7 to your computer and use it in GitHub Desktop.
Laravel valet driver for Bow framework
This file contains 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
<?php | |
class BowValetDriver extends ValetDriver | |
{ | |
/** | |
* Determine if the driver serves the request. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return bool | |
*/ | |
public function serves($sitePath, $siteName, $uri) | |
{ | |
return (file_exists($sitePath.'/public/index.php')) && | |
(file_exists($sitePath.'/app/Kernel.php') || file_exists($sitePath.'/app/ErrorHandle.php') ) && | |
(file_exists($sitePath.'/bow')) | |
; | |
} | |
/** | |
* Determine if the incoming request is for a static file. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return string|false | |
*/ | |
public function isStaticFile($sitePath, $siteName, $uri) | |
{ | |
if ($this->isActualFile($staticFilePath = $sitePath.'/public/'.$uri)) { | |
return $staticFilePath; | |
} | |
return false; | |
} | |
/** | |
* Get the fully resolved path to the application's front controller. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return string | |
*/ | |
public function frontControllerPath($sitePath, $siteName, $uri) | |
{ | |
if (file_exists($frontControllerPath = $sitePath.'/public/index.php')) { | |
return $frontControllerPath; | |
} | |
} | |
} |
I had never seen that before !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use
Create new file in
.config/valet/Drivers/BowValetDriver.php
and put this content