Symfony console helper to create a table

Code
<?php

use Symfony\Component\Console\Helper\Table;
use 
Symfony\Component\Console\Output\StreamOutput;

$rows = [
    [
        
'col1' => 1,
        
'col2' => 'foo',
        
'col3' => 'first',
    ],
    [
        
'col1' => 2,
        
'col2' => 'bar',
        
'col3' => 'second',
    ],
    [
        
'col1' => 3,
        
'col2' => 'baz',
        
'col3' => 'third',
    ],
];

$stream fopen('php://output''w');
$output = new StreamOutput($stream);

$table = new Table($output);
$table->setHeaders(array_keys($rows[0]));
$table->addRows($rows);

echo 
'<pre>';
$table->render();
echo 
'</pre>';
Result
+------+------+--------+
| col1 | col2 | col3   |
+------+------+--------+
| 1    | foo  | first  |
| 2    | bar  | second |
| 3    | baz  | third  |
+------+------+--------+
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8