Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mehany's avatar
Level 13

How to output a new line in console with artisan console command?

Hi, I would like to out put a new line on the console to give the user an update on the setup progress. I tried \n but that didn't work. Here is what I have:

$this->info(' Setting up database migrations .... .');
$main = $this->output->createProgressBar(100);

$this->call('migrate:install');
$this->call('migrate:refresh');
$this->call('start:data');
$this->call('roles:make');

$main->finish();

$this->info(' Done.');

// output

100/100 [============================] 100% Application data has been generated.
100/100 [============================] 100% Roles Has been created.
100/100 [============================] 100% Done.

I prefer the output to be

100/100 [============================] 100% 
Application data has been generated.
100/100 [============================] 100% 
Roles Has been created.
100/100 [============================] 100% 
Done.

P.S

right now I can do the below to output a newline. I am looking for something like $this->info(' Done. \n' );

$this->info('');
$this->info(' Done.');
                
0 likes
2 replies
zachleigh's avatar

Try using double quotes around the newline.

$this->info(' Done. ' . "\n");
9 likes
sayemk's avatar

Try using PHP_EOL like

$this->info(' Done. ' . PHP_EOL);

10 likes

Please or to participate in this conversation.