|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Valet\Drivers\Custom; |
|
4
|
|
|
|
|
5
|
|
|
use Composer\InstalledVersions; |
|
6
|
|
|
use Valet\Drivers\BasicValetDriver; |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @experimental This driver is experimental and may be unstable. Report issues at GitHub! |
|
10
|
|
|
* |
|
11
|
|
|
* @see https://github.com/hydephp/realtime-compiler/pull/30 |
|
12
|
|
|
*/ |
|
13
|
|
|
class HydeValetDriver extends BasicValetDriver |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* Determine if the driver serves the request. |
|
17
|
|
|
*/ |
|
18
|
|
|
public function serves(string $sitePath, string $siteName, string $uri): bool |
|
19
|
|
|
{ |
|
20
|
|
|
return file_exists($sitePath.'/hyde'); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Take any steps necessary before loading the front controller for this driver. |
|
25
|
|
|
*/ |
|
26
|
|
|
public function beforeLoading(string $sitePath, string $siteName, string $uri): void |
|
27
|
|
|
{ |
|
28
|
|
|
// Set the correct autoloader path for the realtime compiler |
|
29
|
|
|
putenv('HYDE_AUTOLOAD_PATH='.$sitePath.'/vendor/autoload.php'); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Determine if the incoming request is for a static file. |
|
34
|
|
|
*/ |
|
35
|
|
|
public function isStaticFile(string $sitePath, string $siteName, string $uri): false |
|
36
|
|
|
{ |
|
37
|
|
|
return false; // Handled by the realtime compiler |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Get the fully resolved path to the application's front controller. |
|
42
|
|
|
*/ |
|
43
|
|
|
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string |
|
44
|
|
|
{ |
|
45
|
|
|
return $sitePath.'/vendor/hyde/realtime-compiler/bin/server.php'; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get the logs paths for the application to show in Herds log viewer. |
|
50
|
|
|
*/ |
|
51
|
|
|
public function logFilesPaths(): array |
|
52
|
|
|
{ |
|
53
|
|
|
return ['/storage/logs']; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Display information about the application in the information tab of the Sites UI. |
|
58
|
|
|
*/ |
|
59
|
|
|
public function siteInformation(string $sitePath, string $phpBinary): array |
|
60
|
|
|
{ |
|
61
|
|
|
$composerJson = json_decode(file_get_contents($sitePath.'/composer.json'), true); |
|
62
|
|
|
$hydeConfig = include $sitePath.'/config/hyde.php'; |
|
63
|
|
|
|
|
64
|
|
|
return [ |
|
65
|
|
|
'HydePHP Info' => [ |
|
66
|
|
|
'Hyde Version' => InstalledVersions::isInstalled('hyde/hyde') ? InstalledVersions::getPrettyVersion('hyde/hyde') : 'Unknown', |
|
67
|
|
|
'Framework Version' => InstalledVersions::getPrettyVersion('hyde/framework') ?: 'Unknown', |
|
68
|
|
|
'Site Name' => $hydeConfig['name'] ?? 'Unknown', |
|
69
|
|
|
'Site URL' => $hydeConfig['url'] ?? 'Not set', |
|
70
|
|
|
'Site Language' => $hydeConfig['language'] ?? 'en', |
|
71
|
|
|
'Output Directory' => $hydeConfig['output_directory'] ?? '_site', |
|
72
|
|
|
], |
|
73
|
|
|
'Build Info' => [ |
|
74
|
|
|
'Pretty URLs' => $hydeConfig['pretty_urls'] ? 'Enabled' : 'Disabled', |
|
75
|
|
|
'Generate Sitemap' => $hydeConfig['generate_sitemap'] ? 'Yes' : 'No', |
|
76
|
|
|
'RSS Feed' => ($hydeConfig['rss']['enabled'] ?? false) ? 'Enabled' : 'Disabled', |
|
77
|
|
|
'Source Root' => $hydeConfig['source_root'] ?: '(Project Root)', |
|
78
|
|
|
], |
|
79
|
|
|
'Features' => [ |
|
80
|
|
|
'Enabled Features' => implode(', ', array_map(function ($feature) { |
|
81
|
|
|
return $feature->name; |
|
82
|
|
|
}, $hydeConfig['features'] ?? [])), |
|
83
|
|
|
], |
|
84
|
|
|
'Server Configuration' => [ |
|
85
|
|
|
'Port' => $hydeConfig['server']['port'] ?? 8080, |
|
86
|
|
|
'Host' => $hydeConfig['server']['host'] ?? 'localhost', |
|
87
|
|
|
'Save Preview' => ($hydeConfig['server']['save_preview'] ?? true) ? 'Yes' : 'No', |
|
88
|
|
|
'Live Edit' => ($hydeConfig['server']['live_edit'] ?? false) ? 'Enabled' : 'Disabled', |
|
89
|
|
|
'Dashboard' => ($hydeConfig['server']['dashboard']['enabled'] ?? true) ? 'Enabled' : 'Disabled', |
|
90
|
|
|
], |
|
91
|
|
|
]; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths