1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 08:10:07 +01:00

Small changes to allow Valet to be used in non-CLI contexts

This commit is contained in:
Matt Stauffer
2021-03-31 11:09:37 -04:00
parent 2cead8d611
commit a59a4624fa
2 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,10 @@
<?php
if (php_sapi_name() !== "cli") {
// Allow bypassing these checks if using Valet in a non-CLI app
return;
}
/**
* Check the system's compatibility with Valet.
*/

View File

@@ -4,21 +4,22 @@
use Exception;
use Illuminate\Container\Container;
use Symfony\Component\Process\Process;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\ConsoleOutput;
/**
* Define the ~/.config/valet path as a constant.
* Define constants
*/
define('VALET_LOOPBACK', '127.0.0.1');
define('VALET_HOME_PATH', $_SERVER['HOME'].'/.config/valet');
define('VALET_SERVER_PATH', realpath(__DIR__ . '/../../server.php'));
define('VALET_STATIC_PREFIX', '41c270e4-5535-4daa-b23e-c269744c2f45');
if (! defined('VALET_LOOPBACK')) {
define('VALET_LOOPBACK', '127.0.0.1');
define('VALET_HOME_PATH', $_SERVER['HOME'] . '/.config/valet');
define('VALET_SERVER_PATH', realpath(__DIR__ . '/../../server.php'));
define('VALET_STATIC_PREFIX', '41c270e4-5535-4daa-b23e-c269744c2f45');
define('VALET_LEGACY_HOME_PATH', $_SERVER['HOME'].'/.valet');
define('VALET_LEGACY_HOME_PATH', $_SERVER['HOME'] . '/.valet');
define('BREW_PREFIX', (new CommandLine())->runAsUser('printf $(brew --prefix)'));
define('BREW_PREFIX', (new CommandLine())->runAsUser('printf $(brew --prefix)'));
}
/**
* Output the given text to the console.
@@ -28,7 +29,7 @@
*/
function info($output)
{
output('<info>'.$output.'</info>');
output('<info>' . $output . '</info>');
}
/**
@@ -39,7 +40,7 @@ function info($output)
*/
function warning($output)
{
output('<fg=red>'.$output.'</>');
output('<fg=red>' . $output . '</>');
}
/**
@@ -70,7 +71,7 @@ function output($output)
return;
}
(new ConsoleOutput)->writeln($output);
(new ConsoleOutput())->writeln($output);
}
if (! function_exists('resolve')) {