Skip to content

Commit 8cf9bd2

Browse files
committed
Adding support for Nette Framework.
1 parent b2cddba commit 8cf9bd2

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Valet\Drivers\Specific;
4+
5+
use Valet\Drivers\ValetDriver;
6+
7+
class NetteValetDriver extends ValetDriver
8+
{
9+
/**
10+
* Determine if the driver serves the request.
11+
*/
12+
public function serves(string $sitePath, string $siteName, string $uri): bool
13+
{
14+
return file_exists($sitePath.'/www');
15+
}
16+
17+
/**
18+
* Determine if the incoming request is for a static file.
19+
*/
20+
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */
21+
{
22+
if ($this->isActualFile($staticFilePath = $sitePath.'/www/'.$uri)) {
23+
return $staticFilePath;
24+
}
25+
26+
return false;
27+
}
28+
29+
/**
30+
* Get the fully resolved path to the application's front controller.
31+
*/
32+
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
33+
{
34+
$_SERVER['DOCUMENT_ROOT'] = $sitePath.'/www';
35+
$_SERVER['SCRIPT_FILENAME'] = $sitePath.'/www/index.php';
36+
$_SERVER['SCRIPT_NAME'] = '/index.php';
37+
$_SERVER['PHP_SELF'] = '/index.php';
38+
39+
return $sitePath.'/www/index.php';
40+
}
41+
}

0 commit comments

Comments
 (0)