PHPackages                             gugglegum/clv-rw - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. gugglegum/clv-rw

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

gugglegum/clv-rw
================

Reader and writer for text files with constant length values

1.0.1(7y ago)0767↓50%1MITPHPPHP &gt;=7.0.0

Since Nov 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/gugglegum/clv-rw)[ Packagist](https://packagist.org/packages/gugglegum/clv-rw)[ RSS](/packages/gugglegum-clv-rw/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (1)

Reader &amp; Writer for text files with Constant Length Values
==============================================================

[](#reader--writer-for-text-files-with-constant-length-values)

This is a very rarely used data format, which is a text file with fixed-length lines. It's a table data with rows and cells. Rows are text lines separated by `LF` or `CR`+`LF` (`\n` or `\r\n`). Cells have a fixed size, so no special separator character is used. Excess space is filled with spaces.

This format has more disadvantages than advantages, so use it only to interact with older systems. Do not use this format in new services. CSV or JSON is better in every way. The main limitation of this format is that value cannot be greater than predefined size of column. But if you'll define big size of column — many cells will be filled mostly with spaces.

This library written so you can work both with files and streams. So you can read from `stdin`, write to `stdout` or work with temporary files created by `tmpfile()`.

I encountered this format during integration with API of the Hanes (clothing vendor). I don't know if this file format has any well-established name. I called it "CLV" which is abbreviation for "Constant Length Values". I could call it "Fixed Length Values" but the abbreviation "FLV" is already taken for "Flash Video".

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

[](#installation)

```
composer require gugglegum/clv-rw

```

Usage
-----

[](#usage)

See `/examples` section.

Troubleshooting
---------------

[](#troubleshooting)

If you have troubles with MAC's line-endings `\r`, you may turn on PHP option `auto_detect_line_endings`:

> When turned on, PHP will examine the data read by fgets() and file() to see if it is using Unix, MS-Dos or Macintosh line-ending conventions.

It may be turned on from you PHP code. Just add this before reading MAC files:

```
ini_set('auto_detect_line_endings', true);
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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

Every ~1 days

Total

2

Last Release

2729d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c7fbb933ba217a413e632183e6061f81bd1d285bb86efa82289977038577d88?d=identicon)[gugglegum](/maintainers/gugglegum)

---

Top Contributors

[![gugglegum](https://avatars.githubusercontent.com/u/1580712?v=4)](https://github.com/gugglegum "gugglegum (6 commits)")

---

Tags

parserwriterreadertexttablecolumnsfixed lengthcellsfixed sizeconstant sizeconstant length

### Embed Badge

![Health badge](/badges/gugglegum-clv-rw/health.svg)

```
[![Health](https://phpackages.com/badges/gugglegum-clv-rw/health.svg)](https://phpackages.com/packages/gugglegum-clv-rw)
```

###  Alternatives

[bcncommerce/json-stream

A bundle of tools to work with JSON in PHP

642.2M3](/packages/bcncommerce-json-stream)[veewee/xml

XML without worries

1835.9M29](/packages/veewee-xml)[creof/wkb-parser

Parser for well-known binary (WKB/EWKB) object data

615.1M16](/packages/creof-wkb-parser)[dallgoot/yaml

Provides loader, dumper and an API for YAML content. Loader builds to equivalent data types in PHP 8.x

43185.8k6](/packages/dallgoot-yaml)[creof/geo-parser

Parser for geography coordinate strings

624.4M15](/packages/creof-geo-parser)[creof/wkt-parser

Parser for well-known text (WKT) object strings

554.8M16](/packages/creof-wkt-parser)

PHPackages © 2026

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