nethercore/csv-exporter

CSV Exporter for laravel

1.0.1 2024-09-10 01:23 UTC

This package is auto-updated.

Last update: 2025-08-10 22:32:03 UTC


README

Installation via composer:

composer require nethercore/csv-exporter

Usage:

Generated files will appear in App/Exports/{name}Export.php

Use double backslashes for nested name or model files.

php artisan make:export {name} {model}

e.g php artisan make:export Wharehouse\\Product Stock\\Item will create app/Exports/Wharehouse/ProductExport.php using Models/Stock/Item.php inside the export file.

Example Code:

namespace App\Exports;

use App\Models\Product;
use Nethercore\CsvExporter\Interfaces\BaseExporterInterface;
use Nethercore\CsvExporter\Traits\StreamResponseTrait;
use Symfony\Component\HttpFoundation\StreamedResponse;

final class ProductExport implements BaseExporterInterface
{
    use StreamResponseTrait;
    ...
}
use App\Exports\ProductExport;

class ProductController extends Controller
{
    public function export()
    {
        return (new ProductExport('some product title'))->export());
    }
}