kherge/file-manager
Strict file and stream manager for PHP: safe read/write operations with unified APIs for files, in-memory strings, and existing streams. Supports iteration over contents and consistent handling via File, Memory, and Stream managers.
Manages strict read and write operations for files and file streams.
use KHerGe\File\File;
// Create a new file manager.
$file = new File('example.txt', 'r');
// Iterate through the contents of the file.
foreach ($file->iterate() as $buffer) {
// ...
}
Add as a dependency to a Composer managed project.
composer require kherge/file-manager
Please refer to FileInterface for documentation.
use KHerGe\File\File;
use KHerGe\File\Memory;
use KHerGe\File\Stream;
// Create a manager for a file.
$manager = new File('example.txt', 'r');
// Create a manager for a string.
$manager = new Memory('example contents', false);
// Create a manager for a file stream.
$manager = new Stream($stream);
File Manager is dual licensed under MIT and Apache 2.0.
How can I help you explore Laravel packages today?