Skip to content

Instantly share code, notes, and snippets.

@thinkerytim
Created April 5, 2017 04:29
Show Gist options
  • Save thinkerytim/4c0aff3e2f7f43e03dba4d2281b7b1f5 to your computer and use it in GitHub Desktop.
Save thinkerytim/4c0aff3e2f7f43e03dba4d2281b7b1f5 to your computer and use it in GitHub Desktop.
Laravel Valet Driver for Joomla
<?php
class JoomlaValetDriver 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)
{
if (is_dir($sitePath.'/administrator/components/com_admin')) {
return true;
}
return false;
}
/**
* 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)
{
/* Joomla doesn't really have this concept, so if a file exists, serve it */
if (file_exists($uri)) {
return $uri;
}
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)
{
return $sitePath.'/index.php';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment