mini\Table\CSVTable class

Documentation

Table backed by CSV data

Reads CSV from a file path or string content. First row is used as column headers. Column types are inferred from the data.

// From file
$table = CSVTable::fromFile('data.csv');

// From string
$table = CSVTable::fromString("id,name\n1,Alice\n2,Bob");

// With custom delimiter
$table = CSVTable::fromFile('data.tsv', "\t");

Inheritance

Extends: mini\Table\AbstractTable

Implements: mini\Table\Contracts\SetInterface IteratorAggregate Countable Traversable mini\Table\Contracts\TableInterface

Properties (4)

private array $rows
protected ?Closure $compareFn
protected ?int $limit
protected int $offset

Methods (38)

Documentation missing

Create table from a CSV file

Create table from a CSV string

Create table from a file handle

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Hook for subclasses to customize clone behavior

Get column name(s) that the row key represents

Get the string comparison function for sorting

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Get the current table alias (null if not set)

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Check if value(s) exist in the table's projected columns

Get the primary key column definition (cached)

Iterate over rows with visible columns only

Get columns available for output

Get all column definitions regardless of projection

Narrow to specific columns

Load a single row by its row ID

Get a property value

Check if a property exists (including null values)

Return table with property set

Source

src/Table/CSVTable.php:32-294