Created
March 28, 2017 21:10
-
-
Save SamStenton/9811f27526d4d094bf5a62ff6da22b4f to your computer and use it in GitHub Desktop.
Laravel valet driver for the Themosis 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 ThemosisValetDriver extends BasicValetDriver | |
{ | |
/** | |
* Mutate the incoming URI. | |
* | |
* @param string $uri | |
* @return string | |
*/ | |
public function mutateUri($uri) | |
{ | |
return rtrim('/htdocs'.$uri, '/'); | |
} | |
/** | |
* 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.'/library/Thms/Config/Environment.php'); | |
} | |
/** | |
* 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 (strpos($uri, '/cms/') !== false) { | |
$_SERVER['PHP_SELF'] = $uri; | |
return parent::frontControllerPath($sitePath, $siteName, $uri); | |
} | |
return $sitePath.'/htdocs/index.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment