2017 © Pedro Peláez
 

library file-chainer

Chainable file stream writer with insert support

image

prewk/file-chainer

Chainable file stream writer with insert support

  • Sunday, December 14, 2014
  • by prewk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 211 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 4 % Grown

The README.md

file-chainer Build Status

What is it?

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

Installation

Add to composer:, (*2)

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

And run composer install., (*3)

Usage

Two new file stream methods:, (*4)

  • finsert inserts a string at the current file stream position
  • finsertcsv inserts a csv (like fputcsv) line at the current file stream position

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

$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

The Versions

14/12 2014

dev-master

9999999-dev https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

14/12 2014

0.3.0

0.3.0.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

21/10 2014

0.2.1

0.2.1.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

29/09 2014

0.1.1

0.1.1.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

29/09 2014

0.2.0

0.2.0.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

28/09 2014

0.1.0

0.1.0.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

28/09 2014

0.0.4

0.0.4.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

28/09 2014

0.0.5

0.0.5.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

28/09 2014

0.0.3

0.0.3.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

28/09 2014

0.0.2

0.0.2.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

28/09 2014

0.0.1

0.0.1.0 https://github.com/prewk/file-chainer

Chainable file stream writer with insert support

  Sources   Download

MIT

The Requires

  • php >=5.3.0