Acacha\Llum\Traits\Serve::serve PHP Method

serve() protected method

Serve command.
protected serve ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function serve(InputInterface $input, OutputInterface $output)
    {
        $port = $this->port($input);
        $continue = true;
        do {
            if ($this->check_port($port)) {
                $this->output->writeln('<info>Running php artisan serve --port=' . $port . '</info>');
                exec('php artisan serve --port=' . $port . ' > /dev/null 2>&1 &');
                sleep(1);
                if (file_exists('/usr/bin/sensible-browser')) {
                    $this->output->writeln('<info>Opening http://localhost:' . $port . ' with default browser</info>');
                    passthru('/usr/bin/sensible-browser http://localhost:' . $port);
                }
                $continue = false;
            }
            ++$port;
        } while ($continue);
    }