Search code examples
phplaravellaravel-4

How to display Laravel artisan command output on same line?


I would like to display processing progress using a simple series of dots. This is easy in the browser, just do echo '.' and it goes on the same line, but how do I do this on the same line when sending data to the artisan commandline?

Each subsequent call to $this->info('.') puts the dot on a new line.


Solution

  • The method info uses writeln, it adds a newline at the end, you need to use write instead.

    //in your command
    $this->output->write('my inline message', false);
    $this->output->write('my inline message continues', false);