Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions drivers/StaticValetDriver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

class StaticValetDriver 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)
{
return file_exists($sitePath.'/index.html');
}

/**
* 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)
{
return $sitePath.$uri;
}

/**
* 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.html';
}
}
1 change: 1 addition & 0 deletions drivers/ValetDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static function assign($sitePath, $siteName, $uri)

$drivers[] = 'StatamicValetDriver';
$drivers[] = 'LaravelValetDriver';
$drivers[] = 'StaticValetDriver';

foreach ($drivers as $driver) {
$driver = new $driver;
Expand Down
1 change: 1 addition & 0 deletions server.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function show_valet_404()
require_once __DIR__.'/drivers/ValetDriver.php';
require_once __DIR__.'/drivers/StatamicValetDriver.php';
require_once __DIR__.'/drivers/LaravelValetDriver.php';
require_once __DIR__.'/drivers/StaticValetDriver.php';

$valetDriver = ValetDriver::assign($valetSitePath, $siteName, $uri);

Expand Down