command() public method

Define a CLI command using a string expression and a callable.
public command ( string $expression, callable | string | array $callable, array $aliases = [] ) : Command
$expression string Defines the arguments and options of the command.
$callable callable | string | array Called when the command is called. When using a container, this can be a "pseudo-callable" i.e. the name of the container entry to invoke.
$aliases array An array of aliases for the command.
return Silly\Command\Command
Ejemplo n.º 1
0
/**
 * Prune missing directories and symbolic links on every command.
 */
if (is_dir(VALET_HOME_PATH)) {
    Configuration::prune();
    Site::pruneLinks();
}
/**
 * Allow Valet to be run more conveniently by allowing the Node proxy to run password-less sudo.
 */
$app->command('install', function () {
    //Caddy::stop();
    Configuration::install();
    Caddy::install();
    //PhpFpm::install();
    //DnsMasq::install();
    //Caddy::restart();
    //Valet::symlinkToUsersBin();
    //Brew::createSudoersEntry();
    //Valet::createSudoersEntry();
    output(PHP_EOL . '<info>Valet installed successfully!</info>');
})->descriptions('Install the Valet services');
/**
 * Allow Valet to be run more conveniently by allowing the Node proxy to run password-less sudo.
 */
$app->command('share', function () {
    $localDomain = basename(getcwd()) . '.' . Configuration::read()['domain'];
    $cmd = 'start cmd.exe @cmd /k "' . VALET_BIN_PATH . 'ngrok http -host-header=rewrite ' . $localDomain . ':80"';
    pclose(popen($cmd, "r"));
    $sharedUrl = Ngrok::currentTunnelUrl();
    exec('echo ' . $sharedUrl . ' | clip');
    output(PHP_EOL . '<info>The shared url: ' . $sharedUrl . ' is in your clipboard!</info>');
Ejemplo n.º 2
0
/**
 * Prune missing directories and symbolic links on every command.
 */
if (is_dir(VALET_HOME_PATH)) {
    Configuration::prune();
    Site::pruneLinks();
}
/**
 * Allow Valet to be run more conveniently by allowing the Node proxy to run password-less sudo.
 */
$app->command('install', function () {
    Caddy::stop();
    Configuration::install();
    Caddy::install();
    PhpFpm::install();
    DnsMasq::install();
    Caddy::restart();
    Valet::symlinkToUsersBin();
    Valet::createSudoersEntry();
    passthru('/bin/bash ' . __DIR__ . '/scripts/install-packages.sh');
    output(PHP_EOL . '<info>Valet installed successfully!</info>');
})->descriptions('Install the Valet services');
/**
 * Get or set the domain currently being used by Valet.
 */
$app->command('domain [domain]', function ($domain = null) {
    if ($domain === null) {
        return info(Configuration::read()['domain']);
    }
    DnsMasq::updateDomain($oldDomain = Configuration::read()['domain'], $domain = trim($domain, '.'));
    Configuration::updateKey('domain', $domain);
    Site::resecureForNewDomain($oldDomain, $domain);
Ejemplo n.º 3
0
/**
 * Prune missing directories and symbolic links on every command.
 */
if (is_dir(VALET_HOME_PATH)) {
    Configuration::prune();
    Site::pruneLinks();
}
/**
 * Allow Valet to be run more conveniently by allowing the Node proxy to run password-less sudo.
 */
$app->command('install', function () {
    Caddy::stop();
    Configuration::install();
    Caddy::install();
    PhpFpm::install();
    DnsMasq::install();
    Caddy::restart();
    Valet::symlinkToUsersBin();
    Brew::createSudoersEntry();
    Valet::createSudoersEntry();
    output(PHP_EOL . '<info>Valet installed successfully!</info>');
})->descriptions('Install the Valet services');
/**
 * Get or set the domain currently being used by Valet.
 */
$app->command('domain [domain]', function ($domain = null) {
    if ($domain === null) {
        return info(Configuration::read()['domain']);
    }
    DnsMasq::updateDomain($oldDomain = Configuration::read()['domain'], $domain = trim($domain, '.'));
    Configuration::updateKey('domain', $domain);
    Site::resecureForNewDomain($oldDomain, $domain);