Currently only an October v3 driver.
Last active
February 21, 2025 14:26
-
-
Save OlinB/7017376db5dd7eda8286f2513f76c314 to your computer and use it in GitHub Desktop.
Laravel Herd OctoberCMS driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Valet\Drivers\Custom; | |
use Valet\Drivers\LaravelValetDriver; | |
class OctobercmsValetDriver extends LaravelValetDriver { | |
public function serves(string $sitePath, string $siteName, string $uri): bool | |
{ | |
return file_exists($sitePath . '/bootstrap/autoload.php') && file_exists($sitePath . '/modules/system/console/OctoberAbout.php'); | |
} | |
/** | |
* Get the logs paths for the application to show in Herds log viewer. | |
*/ | |
public function logFilesPaths() { | |
return [ | |
"/storage/logs" | |
]; | |
} | |
public function isStaticFile($sitePath, $siteName, $uri) | |
{ | |
if (file_exists($staticFilePath = $sitePath.'/'.$uri)) { | |
return $staticFilePath; | |
} | |
return false; | |
} | |
public function frontControllerPath($sitePath, $siteName, $uri): ?string | |
{ | |
return $sitePath.'/index.php'; | |
} | |
public function siteInformation(string $sitePath, string $phpBinary): array | |
{ | |
try { | |
$result = shell_exec($phpBinary . ' ' . $sitePath . '\artisan october:about --json'); | |
if ($result) { | |
return json_decode($result, true); | |
} else { | |
return ['Error' => ['Message' => 'No result']]; | |
} | |
} catch (\Exception $e) { | |
return [ | |
'Error' => ['message' => $e->getMessage()], | |
]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment