Skip to content

Commit

Permalink
Adding support for Nette Framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
antonL95 committed May 14, 2024
1 parent b2cddba commit 8cf9bd2
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cli/Valet/Drivers/Specific/NetteValetDriver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Valet\Drivers\Specific;

use Valet\Drivers\ValetDriver;

class NetteValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return file_exists($sitePath.'/www');
}

/**
* Determine if the incoming request is for a static file.
*/
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */
{
if ($this->isActualFile($staticFilePath = $sitePath.'/www/'.$uri)) {
return $staticFilePath;
}

return false;
}

/**
* Get the fully resolved path to the application's front controller.
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
{
$_SERVER['DOCUMENT_ROOT'] = $sitePath.'/www';
$_SERVER['SCRIPT_FILENAME'] = $sitePath.'/www/index.php';
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['PHP_SELF'] = '/index.php';

return $sitePath.'/www/index.php';
}
}

0 comments on commit 8cf9bd2

Please sign in to comment.