PHPackages                             maximal/tsv - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. maximal/tsv

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

maximal/tsv
===========

Library for working with the tab-separated values format (TSV).

v1.0(7mo ago)03.8k—3.7%MITPHPPHP &gt;=8.0

Since Sep 21Pushed 7mo agoCompare

[ Source](https://github.com/maximal/tsv-php)[ Packagist](https://packagist.org/packages/maximal/tsv)[ RSS](/packages/maximal-tsv/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

TSV library for PHP
===================

[](#tsv-library-for-php)

This is a small PHP library for working with the [tab-separated values](https://en.wikipedia.org/wiki/Tab-separated_values)format (TSV) without any dependencies.

Installation
------------

[](#installation)

Install the library via [Composer](https://getcomposer.org/):

```
composer require maximal/tsv
```

Usage
-----

[](#usage)

```
require_once __DIR__ . '/vendor/autoload.php';

use Maximal\Tsv\Tsv;

// Get TSV text for the given two-dimensional data table
$tsvString = Tsv::getTsv($dataTable);
// Every cell value in `Tsv::getTsv()` call will be cast to string using `(string)$value`.
// Make sure all values are castable, e.g. all the classes have `__toString()` methods.

// Get two-dimensional data table for the given TSV text
$table = Tsv::getTable($tsvString);
```

Value escaping
--------------

[](#value-escaping)

This library uses the most common special characters escaping:

Escape SequenceCharacter`\t`tab`\r`carriage return`\n`line feed`\\`backslashThis works two-way: `TSV → array → TSV` conversion gives the initial TSV text.

Transitive Equivalence
----------------------

[](#transitive-equivalence)

Let’s review an example of chained `table → TSV → table → TSV` conversion:

```
// Initial two-dimensional data table
$dataTable = [[/* ... */], [/* ... */], /* ... */];
// $dataTable is `array`

// TSV text from the initial data
$tsv = Tsv::getTsv($dataTable);
// $tsv is `string`

// Data table taken back from resulting TSV text
$tableFromTsv = Tsv::getTable($tsv);
// $tableFromTsv is `list`

// TSV text again
$tsvFromTable = Tsv::getTsv($dataTable);
// $tsvFromTable is `string`

// `$tsv === $tsvFromTable` equality is guaranteed
// `$dataTable === $tsvFromTable` equality is NOT guaranteed
```

Here, `$tsv` text is guaranteed to be equal to `$tsvFromTable`: both are strings and similarly formatted.

However, `$dataTable` is not guaranteed to be equal to `$tableFromTsv`because the initial array can have various keys and different value types (`array`) while the resulting array is strictly a collection of list of strings (`list`).

Coding Style
------------

[](#coding-style)

[PER-3T](https://github.com/maximal/per-3t) / PSR-12T (PHP’s standard [PER-3](https://www.php-fig.org/per/coding-style/) / [PSR-12](https://www.php-fig.org/psr/psr-12/)with [SmartTabs](https://www.emacswiki.org/emacs/SmartTabs) instead of spaces).

Author
------

[](#author)

-
-
-

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance62

Regular maintenance activity

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

239d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/980679?v=4)[MaximAL](/maintainers/maximal)[@maximal](https://github.com/maximal)

---

Top Contributors

[![maximal](https://avatars.githubusercontent.com/u/980679?v=4)](https://github.com/maximal "maximal (1 commits)")

---

Tags

librarytsvtab-separated values

### Embed Badge

![Health badge](/badges/maximal-tsv/health.svg)

```
[![Health](https://phpackages.com/badges/maximal-tsv/health.svg)](https://phpackages.com/packages/maximal-tsv)
```

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

70036.3M116](/packages/league-iso3166)[league/statsd

A simple library for working with StatsD in PHP.

3514.3M12](/packages/league-statsd)[payum/iso4217

ISO 4217 PHP Library

16312.1M5](/packages/payum-iso4217)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
