Skip to content

Instantly share code, notes, and snippets.

@n1215
Created May 16, 2016 10:48
Show Gist options
  • Save n1215/1e1631c2f11c855aaaddaaf8fca16bba to your computer and use it in GitHub Desktop.
Save n1215/1e1631c2f11c855aaaddaaf8fca16bba to your computer and use it in GitHub Desktop.
Laravel Valet custom driver for concrete5.
<?php
class Concrete5ValetDriver 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 is_dir($sitePath.'/web/concrete');
}
/**
* 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.'/web'.$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)
{
$_SERVER['SCRIPT_FILENAME'] = $sitePath.'/web/index.php';
return $sitePath.'/web/index.php';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment