Copied!
CloneableInstantiable
Methods
public __construct(Symfony\Component\Console\Output\OutputInterface $output)
public addRow(Symfony\Component\Console\Helper\TableSeparator|array $row) : static
 
  • return $this
public addRows(array $rows) : static
 
  • return $this
public appendRow(Symfony\Component\Console\Helper\TableSeparator|array $row) : static
 

Adds a row to the table, and re-renders the table.

  • return $this
public getColumnStyle(int $columnIndex) : Symfony\Component\Console\Helper\TableStyle
 

Gets the current style for a column.

If style was not set, it returns the global table style.

public getStyle() : Symfony\Component\Console\Helper\TableStyle
 

Gets the current table style.

public static getStyleDefinition(string $name) : Symfony\Component\Console\Helper\TableStyle
 

Gets a style definition by name.

public render() : void
 

Renders table to output.

Example:

+---------------+-----------------------+------------------+ | ISBN | Title | Author | +---------------+-----------------------+------------------+ | 99921-58-10-7 | Divine Comedy | Dante Alighieri | | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | +---------------+-----------------------+------------------+

public setColumnMaxWidth(int $columnIndex, int $width) : static
 

Sets the maximum width of a column.

Any cell within this column which contents exceeds the specified width will be wrapped into multiple lines, while formatted strings are preserved.

  • return $this
public setColumnStyle(int $columnIndex, Symfony\Component\Console\Helper\TableStyle|string $name) : static
 

Sets table column style.

  • param \TableStyle|string $name The style name or a TableStyle instance
  • return $this
public setColumnWidth(int $columnIndex, int $width) : static
 

Sets the minimum width of a column.

  • return $this
public setColumnWidths(array $widths) : static
 

Sets the minimum width of all columns.

  • return $this
public setFooterTitle(?string $title) : static
 
  • return $this
public setHeaders(array $headers) : static
 
  • return $this
public setHeaderTitle(?string $title) : static
 
  • return $this
public setHorizontal(bool $horizontal = true) : static
 
  • return $this
public setRow(string|int $column, array $row) : static
 
  • return $this
public setRows(array $rows) : static
 
  • return $this
public setStyle(Symfony\Component\Console\Helper\TableStyle|string $name) : static
 

Sets table style.

  • return $this
public static setStyleDefinition(string $name, Symfony\Component\Console\Helper\TableStyle $style) : void
 

Sets a style definition.

public setVertical(bool $vertical = true) : static
 
  • return $this
Constants
private Symfony\Component\Console\Helper\Table::BORDER_INSIDE = 1
private Symfony\Component\Console\Helper\Table::BORDER_OUTSIDE = 0
private Symfony\Component\Console\Helper\Table::DISPLAY_ORIENTATION_DEFAULT = 'default'
private Symfony\Component\Console\Helper\Table::DISPLAY_ORIENTATION_HORIZONTAL = 'horizontal'
private Symfony\Component\Console\Helper\Table::DISPLAY_ORIENTATION_VERTICAL = 'vertical'
private Symfony\Component\Console\Helper\Table::SEPARATOR_BOTTOM = 3
private Symfony\Component\Console\Helper\Table::SEPARATOR_MID = 2
private Symfony\Component\Console\Helper\Table::SEPARATOR_TOP = 0
private Symfony\Component\Console\Helper\Table::SEPARATOR_TOP_BOTTOM = 1
Properties
private array $columnMaxWidths = []
private array $columnStyles = []
private array $columnWidths = []
private string $displayOrientation = 'default'
private array $effectiveColumnWidths = []
private ?string $footerTitle = NULL
private array $headers = []
private ?string $headerTitle = NULL
private int $numberOfColumns
private Symfony\Component\Console\Output\OutputInterface $output
private bool $rendered = false
private array $rows = []
private Symfony\Component\Console\Helper\TableStyle $style
private static array $styles
Methods
private buildTableRows(array $rows) : Symfony\Component\Console\Helper\TableRows
private calculateColumnsWidth(iterable $groups) : void
 

Calculates columns widths.

private calculateNumberOfColumns(array $rows) : void
 

Calculate number of columns for this table.

private calculateRowCount() : int
private cleanup() : void
 

Called after rendering to cleanup cache data.

private copyRow(array $rows, int $line) : array
private fillCells(iterable $row) : iterable
 

fill cells for a row that contains colspan > 1.

private fillNextRows(array $rows, int $line) : array
 

fill rows that contains rowspan > 1.

  • throws \InvalidArgumentException
private getCellWidth(array $row, int $column) : int
private getColumnSeparatorWidth() : int
private getNumberOfColumns(array $row) : int
 

Gets number of columns by row.

private getRowColumns(array $row) : array
 

Gets list of columns for the given row.

private static initStyles() : array
 
  • return array<string,\TableStyle>
private renderCell(array $row, int $column, string $cellFormat) : string
 

Renders table cell with padding.

private renderColumnSeparator(int $type = 0self::BORDER_OUTSIDE) : string
 

Renders vertical column separator.

private renderRow(array $row, string $cellFormat, ?string $firstCellFormat = NULL) : void
 

Renders table row.

Example:

| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |

private renderRowSeparator(int $type = 2self::SEPARATOR_MID, ?string $title = NULL, ?string $titleFormat = NULL) : void
 

Renders horizontal header separator.

Example:

+-----+-----------+-------+

private resolveStyle(Symfony\Component\Console\Helper\TableStyle|string $name) : Symfony\Component\Console\Helper\TableStyle
Properties
private static array $styles
Methods
public static getStyleDefinition(string $name) : Symfony\Component\Console\Helper\TableStyle
 

Gets a style definition by name.

private static initStyles() : array
 
  • return array<string,\TableStyle>
public static setStyleDefinition(string $name, Symfony\Component\Console\Helper\TableStyle $style) : void
 

Sets a style definition.

© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration