Skip to content

Instantly share code, notes, and snippets.

@OlinB
Last active February 21, 2025 14:26
Show Gist options
  • Save OlinB/7017376db5dd7eda8286f2513f76c314 to your computer and use it in GitHub Desktop.
Save OlinB/7017376db5dd7eda8286f2513f76c314 to your computer and use it in GitHub Desktop.
Laravel Herd OctoberCMS driver

Laravel Herd drivers for use with OctoberCMS

Currently only an October v3 driver.

<?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