Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel Valet driver for Dioscuri
<?php
class DioscuriValetDriver extends BasicValetDriver
{
/**
* Mutate the incoming URI.
*
* @param string $uri
* @return string
*/
public function mutateUri( $uri )
{
return rtrim( '/public' . $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 is_dir( $sitePath . '/public/app/' )
&& is_dir( $sitePath . '/public/wp/' )
&& file_exists( $sitePath . '/public/wp-config.php' )
&& file_exists( $sitePath . '/env.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, '/wp/' ) !== false ) {
$_SERVER['PHP_SELF'] = $uri;
return parent::frontControllerPath( $sitePath, $siteName, $uri );
}
return $sitePath . '/public/index.php';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.