Laravel File Manager is a Bondacom library which provides an efficient way to read or create enormous files.
Note: It requires at least PHP v7.1.
To use package in your Laravel project, run:
composer require bondacom/laravel-file-manager
Note: For Laravel less than 5.5 remember to register manually the service provider!
Copy the config file into your project. For Laravel projects run:
php artisan vendor:publish --provider="Bondacom\LaravelFileManager\Providers\LaravelFileManagerServiceProvider"
It's really simple!
Example - Read a file using default config:
Reader::open($file)->process(function($line) {
// Do what you need here
});
Example - Read a file overriding default config chunk value:
Reader::open($file)->process(function($lines) {
// Do what you need here
}, 1000);
Example - Read a file as csv:
Reader::csv()->open($file)->process(function($line) {
// Do what you need here
});
Example - Write a file
$writer = Writer::new($file)
$writer->add('Hello');
$writer->add('World');
$writer->save();
Example - Write a file as csv
$writer = Writer::csv()->new($file)
$writer->add(['Hello', 'World']);
$writer->save();
Check out contributing guide to get an overview of development.
Look for composer.json.
Laravel File Manager is an open-sourced software licensed under the MIT license