rockbuzz/lara-export

Laravel Export

dev-main 2023-05-17 17:43 UTC

This package is auto-updated.

Last update: 2024-10-17 21:20:59 UTC


README

Laravel Export

Requirements

PHP: >=7.4

Install

$ composer require rockbuzz/lara-export
use Rockbuzz\LaraExport\Export;

class YourController extends Controller
{
    public function index()
    {
        (new Export)
            ->header(['name', 'email'])
            ->data([
                ['name' => 'John Doe', 'email' => 'john@domain.com'],
                ['name' => 'Jane Doe', 'email' => 'jane@domain.com'],
            ])
            //->output(storage_path("app/exports/$filename"), Export::CSV);
            ->save(storage_path("app/exports/$filename"), Export::CSV);
    }

}

License

The Lara Export is open-sourced software licensed under the MIT license.