Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

simondavies's avatar

Valet: Alternative PUBLIC Directory settings

I rename my public directory to html as the media template grid servers I use, use this naming convention, so doing this locally makes sure when i (manually upload yes, manually) all is the same as my local settings etc, and usually i can set up my sites on my homestead yaml setting page etc.

So is there away to add/edit other settings like this?

0 likes
2 replies
simondavies's avatar
simondavies
OP
Best Answer
Level 26

@aarondfrancis yup! thats what I just did.

Called it MediaTempleValetDriver.php

For other here is what i did (nothing really but gives an idea what to do)

class MediaTempleValetDriver extends ValetDriver
{
/**
 * Determine if the driver serves the request.
 *
 * @param  string  $sitePath
 * @param  string  $siteName
 * @param  string  $uri
 * @return void
 */
public function serves($sitePath, $siteName, $uri)
{
    if (file_exists($sitePath.'/html')) {
        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)
{
    if (file_exists($staticFilePath = $sitePath.'/html/'.$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)
{
    return $sitePath.'/html/index.php';
}
 }

Please or to participate in this conversation.