Skip to content

amazzoccone/laravel-file-manager

Repository files navigation

Build Status Latest Stable Version Total Downloads License

Laravel File Manager

Laravel File Manager is a Bondacom library which provides an efficient way to read or create enormous files.

Getting Started

Installation

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!

Configuration

Copy the config file into your project. For Laravel projects run:

php artisan vendor:publish --provider="Bondacom\LaravelFileManager\Providers\LaravelFileManagerServiceProvider"

Usage

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();

Contributing

Check out contributing guide to get an overview of development.

FAQ

Q: Which PHP and Laravel version does use?

Look for composer.json.

License

Laravel File Manager is an open-sourced software licensed under the MIT license

About

Laravel package to manage files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages