Skip to content

Instantly share code, notes, and snippets.

@SamStenton
Created March 28, 2017 21:10
Show Gist options
  • Save SamStenton/9811f27526d4d094bf5a62ff6da22b4f to your computer and use it in GitHub Desktop.
Save SamStenton/9811f27526d4d094bf5a62ff6da22b4f to your computer and use it in GitHub Desktop.
Laravel valet driver for the Themosis framework
<?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