prewk/file-chainer
最新稳定版本:0.3.0
Composer 安装命令:
composer require prewk/file-chainer
包简介
Chainable file stream writer with insert support
README 文档
README
What is it?
A small wrapper for some php file streaming functions with support for inserting data into streams without overwriting. (Also: chainable.)
Installation
Add to composer:
require: { "prewk/file-chainer": "dev-master" }
And run composer install.
Usage
Two new file stream methods:
finsertinserts a string at the current file stream positionfinsertcsvinserts 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
统计信息
- 总下载量: 1.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-09-28