Download the PHP package datasuite/laravel-exporter without Composer

On this page you can find all versions of the php package datasuite/laravel-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-exporter

Laravel Exporter

A fluent, memory-efficient data export package for Laravel supporting CSV, Excel, and JSON formats with rich formatting capabilities.

Features

Installation

The package will automatically register its service provider via Laravel's package auto-discovery.

Publish Configuration (Optional)

Basic Usage

Using the Facade

Using the Class Directly

Data Sources

The exporter supports multiple data sources:

Export Formats

CSV Export

Excel Export

Note: For native XLSX support, install OpenSpout: composer require openspout/openspout Without OpenSpout, exports will use Excel-compatible XML format.

Excel Export with Column Types

Define column types for proper formatting and optional conditional coloring:

Column Types Available

Type Method Description Excel Format
String ->string() Plain text General
Integer ->integer() Whole numbers #,##0
Amount ->amount() Currency with optional conditional coloring #,##0.00 (locale-based)
Amount Plain ->amountPlain() Currency without coloring #,##0.00
Percentage ->percentage() Percentage values 0.00%
Date ->date() Date values DD-MMM-YYYY
DateTime ->datetime() Date and time DD-MMM-YYYY HH:MM:SS
Boolean ->boolean() Yes/No values General
Quantity ->quantity() Numeric quantities #,##0.00

Report Headers (Optional)

Add professional headers to your exports when needed:

Totals Row (Optional)

Automatically calculate and add totals when needed:

Multi-Locale Support & Conditional Coloring

Configure locale-specific number formatting for any country:

Supported Locales (Configurable)

Locale Country Number Format Currency
en_US United States 1,234,567.00 $
en_GB United Kingdom 1,234,567.00 £
en_IN India 12,34,567.00
de_DE Germany 1.234.567,00
fr_FR France 1 234 567,00
ja_JP Japan 1,234,567 ¥
zh_CN China 1,234,567.00 ¥

Add more locales in config/exporter.php.

JSON Export

Column Selection

Simple Columns

Column Aliases

Nested Columns (Dot Notation)

Custom Headers

Row Transformation

Transform each row before export:

Output Methods

Save to File

Download Response

Stream Response (Memory Efficient)

Get as String

Using the Exportable Trait

Add export functionality directly to your models:

Then use it like this:

Controller Example

Memory Optimization

For large datasets, the package automatically uses:

Configuration

Publish the config file to customize defaults:

Requirements

Optional Dependencies

Maatwebsite Excel-Style Exports (NEW!)

If you're familiar with Maatwebsite Excel, you'll feel right at home! We now support the same interface-based Concerns pattern for cleaner, reusable export classes.

Quick Start

Creating an Export Class

Simple Export (FromCollection)

Query-Based Export (FromQuery) - Memory Efficient

Full-Featured Export with Styles

Available Concerns

Concern Description
FromCollection Use a Laravel Collection as data source
FromQuery Use an Eloquent Builder (memory efficient with cursor)
FromArray Use a plain PHP array as data source
FromGenerator Use a Generator for custom iteration
WithHeadings Add column headers to export
WithMapping Transform each row before exporting
WithChunkReading Process data in chunks for very large datasets
WithColumnFormatting Apply number/date formats (requires PhpSpreadsheet)
WithColumnWidths Set fixed column widths
WithStyles Apply cell styles (requires PhpSpreadsheet)
ShouldAutoSize Auto-size columns to fit content
WithTitle Set worksheet title
WithMultipleSheets Export multiple sheets in one file
WithTotals Add a totals/summary row
WithReportHeader Add report header block
WithColumnDefinitions Use column type definitions
WithConditionalColoring Enable conditional coloring
WithFreezeRow Freeze header row
WithAutoFilter Add auto-filter dropdown
WithEvents Register event hooks

Chunked Reading for Large Datasets

For very large datasets (100K+ rows), use WithChunkReading to process data in batches:

Memory Comparison: Method Memory Usage Best For
FromCollection High (loads all) Small datasets (<1K rows)
FromQuery (cursor) Medium Medium datasets (1K-50K rows)
FromQuery + WithChunkReading Low Large datasets (50K+ rows)

Using the Exportable Trait

The Exportable trait adds convenient methods to your export class:

Multiple Sheets

Comparison: Fluent API vs Concerns

Both styles are supported! Choose what works best for your use case:

Fluent API Concerns Pattern
Quick, inline exports Reusable export classes
Good for simple exports Better for complex exports
Less boilerplate More organized
Exporter::make()->from($data) Excel::download(new Export)

Importing Data (Maatwebsite-Style)

The package also supports importing data from CSV, Excel, and JSON files using the same Concerns pattern as Maatwebsite Excel.

Basic Import

Creating an Import Class

Import Concerns

Concern Description
ToModel Convert each row to an Eloquent model
ToCollection Process all rows as a Collection
ToArray Process all rows as an array
OnEachRow Process each row individually
WithHeadingRow Use first row as array keys
WithValidation Validate each row
WithBatchInserts Insert models in batches
WithUpserts Update existing or create new
WithChunkReading Read file in chunks
SkipsOnError Skip rows that cause errors
SkipsOnFailure Skip rows that fail validation
WithStartRow Start reading from specific row
WithLimit Limit number of rows
WithColumnLimit Limit columns to read
WithCalculatedFormulas Get formula results
WithMappedCells Read specific cells
WithMultipleSheets Handle multiple sheets

Import with Upserts (Update or Create)

Handling Validation Failures

ToCollection Import

Converting to Array/Collection

Multi-Sheet Import

Using the Importable Trait

Import Result

Supported File Formats

Format Extension Reader
CSV .csv, .txt, .tsv Native (streaming)
Excel .xlsx, .xls OpenSpout (streaming)
JSON .json Native

License

MIT License


All versions of laravel-exporter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
symfony/http-foundation Version ^6.0|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package datasuite/laravel-exporter contains the following files

Loading the files please wait ...