PHPackages                             oliverde8/fixed-width-file - 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. oliverde8/fixed-width-file

ActiveLibrary

oliverde8/fixed-width-file
==========================

Read and Write fixed width files

1.0.0(11y ago)0211MITPHPPHP &gt;=5.3.0

Since Apr 3Pushed 10y ago1 watchersCompare

[ Source](https://github.com/oliverde8/PHPLib-Fixed-Width-File)[ Packagist](https://packagist.org/packages/oliverde8/fixed-width-file)[ RSS](/packages/oliverde8-fixed-width-file/feed)WikiDiscussions master Synced 1mo ago

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

PHPLib-Fixed-Width-File
=======================

[](#phplib-fixed-width-file)

Allows easy Read(not yet) and write of fixed width file.

[![Latest Stable Version](https://camo.githubusercontent.com/11fa5f7f59ddce8dd0b3cdbd9c649e634fe5bc1e2bc54aef98190416bc078913/68747470733a2f2f706f7365722e707567782e6f72672f6f6c697665726465382f66697865642d77696474682d66696c652f762f737461626c65)](https://packagist.org/packages/oliverde8/fixed-width-file) [![Total Downloads](https://camo.githubusercontent.com/bfc0b42472eb85f90f969e36505c5e7456e3009418a287cddf2b32458e97eefd/68747470733a2f2f706f7365722e707567782e6f72672f6f6c697665726465382f66697865642d77696474682d66696c652f646f776e6c6f616473)](https://packagist.org/packages/oliverde8/fixed-width-file) [![Latest Unstable Version](https://camo.githubusercontent.com/67c71ea3b87d643baa2a524091be77b7ab744840285d7735dd15cb26a852af79/68747470733a2f2f706f7365722e707567782e6f72672f6f6c697665726465382f66697865642d77696474682d66696c652f762f756e737461626c65)](https://packagist.org/packages/oliverde8/fixed-width-file) [![License](https://camo.githubusercontent.com/3e8c341b23261b03e1169701d131ae97d295ba6f8418beb6081ad544b9613b6f/68747470733a2f2f706f7365722e707567782e6f72672f6f6c697665726465382f66697865642d77696474682d66696c652f6c6963656e7365)](https://packagist.org/packages/oliverde8/fixed-width-file)

They are not nice, they are not easy to read but sometimes you just need them.

Howto
-----

[](#howto)

Firs let's create our file :

```
$writer = new Writer('/tmp/file.txt', ' ', STR_PAD_LEFT);

```

First parameter is the name of the file to write Then we have the padding character, by default it is empty. Last we have the direction to pad. right or left.

Now we will declare our columns :

```
$writer->getHeader()
    ->addColumn(4, 'year')
    ->addColumn(2, 'month')
    ->addColumn(2, 'day')
    ->addColumn(20, 'name')
    ->addColumn(100, 'description')

```

Once all this is done we can add data :

```
// First line
$data = array();
$data['year'] = 2016;
$data['month'] = 02;
$data['day'] = 15;
$data['description'] = "This is a description" ;
$writer->writeLine($data);

// second line
$data = array();
$data['year'] = 2016;
$data['month'] = 02;
$data['day'] = 1;
$data['description'] = "This is a description2" ;
$writer->writeLine($data);

```

End finish the write

```
$writer->terminate():

```

This will create a file looking like this :

```
20160215This is a description
201602 1This is a description2

```

Known Issues
------------

[](#known-issues)

- None

The library will write every line as it comes, it was built for handling huge amounts of data and therfore doesen't have a mode where it can write everything at once at the end.

Todo
----

[](#todo)

- Support reading : The same way the files are written we can read them once we have the necessary header informations.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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

4064d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3658513?v=4)[De Cramer Oliver](/maintainers/oliverde8)[@oliverde8](https://github.com/oliverde8)

---

Top Contributors

[![oliverde8](https://avatars.githubusercontent.com/u/3658513?v=4)](https://github.com/oliverde8 "oliverde8 (6 commits)")[![maciejzgadzaj](https://avatars.githubusercontent.com/u/271350?v=4)](https://github.com/maciejzgadzaj "maciejzgadzaj (2 commits)")

---

Tags

phpphp-library

### Embed Badge

![Health badge](/badges/oliverde8-fixed-width-file/health.svg)

```
[![Health](https://phpackages.com/badges/oliverde8-fixed-width-file/health.svg)](https://phpackages.com/packages/oliverde8-fixed-width-file)
```

PHPackages © 2026

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