Skip to content

Instantly share code, notes, and snippets.

@houssenedao
Last active January 24, 2023 02:30
Show Gist options
  • Save houssenedao/1c58377e1609083d34e55c73fc67b5f7 to your computer and use it in GitHub Desktop.
Save houssenedao/1c58377e1609083d34e55c73fc67b5f7 to your computer and use it in GitHub Desktop.
Laravel valet driver for Bow framework
<?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;
}
}
}
@houssenedao
Copy link
Author

How to use

Create new file in .config/valet/Drivers/BowValetDriver.php and put this content

@papac
Copy link

papac commented Jan 24, 2023

I had never seen that before !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment