PHPackages                             prewk/file-chainer - 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. prewk/file-chainer

ActiveLibrary

prewk/file-chainer
==================

Chainable file stream writer with insert support

0.3.0(11y ago)11.1k1MITPHPPHP &gt;=5.3.0

Since Sep 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/prewk/file-chainer)[ Packagist](https://packagist.org/packages/prewk/file-chainer)[ Docs](https://github.com/prewk/file-chainer)[ RSS](/packages/prewk-file-chainer/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (11)Used By (0)

file-chainer [![Build Status](https://camo.githubusercontent.com/1cc125a36f554348b0288e241cb15d3f787fd3ed971662f19c34a8823c57d971/68747470733a2f2f7472617669732d63692e6f72672f707265776b2f66696c652d636861696e65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/prewk/file-chainer)
==================================================================================================================================================================================================================================================================================================

[](#file-chainer-)

What is it?
-----------

[](#what-is-it)

A small wrapper for some php file streaming functions with support for inserting data into streams without overwriting. (Also: chainable.)

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

[](#installation)

Add to composer:

```
require: {
    "prewk/file-chainer": "dev-master"
}
```

And run `composer install`.

Usage
-----

[](#usage)

Two new file stream methods:

- `finsert` inserts a string at the current file stream position
- `finsertcsv` inserts a csv (like [fputcsv](http://se2.php.net/manual/en/function.fputcsv.php)) line at the current file stream position

### Inserting &amp; chaining

[](#inserting--chaining)

```
Prewk\FileChainer::make()
    ->fopen("/foo/bar.txt", "w+")
    ->fwrite("foo")
    ->rewind()
    ->finsert("bar")
    ->fclose();

echo file_get_contents("/foo/bar.txt");
// Output: barfoo
// The handle's file pointer = 3
```

### Inserting with static method

[](#inserting-with-static-method)

```
$handle = fopen("/foo/bar.txt", "w+");
fwrite($handle, "foo");
rewind($handle);

// Statically, using the default "temporary file stream" method
Prewk\FileChainer\Inserters\File::finsert($handle, "bar");

fclose($handle);

echo file_get_contents("/foo/bar.txt");
// Output: barfoo
// The handle's file pointer = 3
```

###  Health Score

29

—

LowBetter than 63% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~8 days

Recently: every ~19 days

Total

10

Last Release

4115d ago

### Community

Maintainers

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

---

Top Contributors

[![prewk](https://avatars.githubusercontent.com/u/640102?v=4)](https://github.com/prewk "prewk (26 commits)")[![aripringle](https://avatars.githubusercontent.com/u/1278449?v=4)](https://github.com/aripringle "aripringle (2 commits)")

### Embed Badge

![Health badge](/badges/prewk-file-chainer/health.svg)

```
[![Health](https://phpackages.com/badges/prewk-file-chainer/health.svg)](https://phpackages.com/packages/prewk-file-chainer)
```

PHPackages © 2026

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