mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 08:10:07 +01:00
Add PHP version to valet links output table
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
class Site
|
||||
{
|
||||
public $brew;
|
||||
public $config;
|
||||
public $cli;
|
||||
public $files;
|
||||
@@ -14,12 +15,14 @@ class Site
|
||||
/**
|
||||
* Create a new Site instance.
|
||||
*
|
||||
* @param Brew $brew
|
||||
* @param Configuration $config
|
||||
* @param CommandLine $cli
|
||||
* @param Filesystem $files
|
||||
*/
|
||||
public function __construct(Configuration $config, CommandLine $cli, Filesystem $files)
|
||||
public function __construct(Brew $brew, Configuration $config, CommandLine $cli, Filesystem $files)
|
||||
{
|
||||
$this->brew = $brew;
|
||||
$this->cli = $cli;
|
||||
$this->files = $files;
|
||||
$this->config = $config;
|
||||
@@ -317,12 +320,14 @@ public function getSites($path, $certs)
|
||||
})->map(function ($path, $site) use ($certs, $config) {
|
||||
$secured = $certs->has($site);
|
||||
$url = ($secured ? 'https' : 'http').'://'.$site.'.'.$config['tld'];
|
||||
$phpVersion = $this->getPhpVersion($site.'.'.$config['tld']);
|
||||
|
||||
return [
|
||||
'site' => $site,
|
||||
'secured' => $secured ? ' X' : '',
|
||||
'url' => $url,
|
||||
'path' => $path,
|
||||
'phpVersion' => $phpVersion,
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -356,6 +361,22 @@ public function pruneLinks()
|
||||
$this->files->removeBrokenLinksAt($this->sitesPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PHP version for the given site.
|
||||
*
|
||||
* @param string $url Site URL including the TLD
|
||||
* @return string
|
||||
*/
|
||||
public function getPhpVersion($url)
|
||||
{
|
||||
$defaultPhpVersion = $this->brew->linkedPhp();
|
||||
$phpVersion = PhpFpm::normalizePhpVersion($this->customPhpVersion($url));
|
||||
if (empty($phpVersion)) {
|
||||
$phpVersion = PhpFpm::normalizePhpVersion($defaultPhpVersion);
|
||||
}
|
||||
return $phpVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resecure all currently secured sites with a fresh configuration.
|
||||
*
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
$app->command('links', function () {
|
||||
$links = Site::links();
|
||||
|
||||
table(['Site', 'SSL', 'URL', 'Path'], $links->all());
|
||||
table(['Site', 'SSL', 'URL', 'Path', 'PHP Version'], $links->all());
|
||||
})->descriptions('Display all of the registered Valet links');
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user