Download the PHP package phpmystic/eloquent-exporter without Composer

On this page you can find all versions of the php package phpmystic/eloquent-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 eloquent-exporter

Eloquent Exporter

Export Eloquent models to CSV & Excel with a fluent API. Supports relationships, custom headers, formatting, chunking, and multi-sheet Excel files.

Requirements

Installation

The service provider is auto-discovered by Laravel.

Basic Usage

From a Query

Custom Headers

Relationships

Relations are eager-loaded automatically to prevent N+1 queries.

BelongsTo / HasOne (Dot Notation)

Name Email Department Manager
John [email protected] Engineering Jane
Sara [email protected] Marketing Bob

HasMany (Comma-Separated)

HasMany relationships are joined into a single cell by default.

Name Roles
John Admin, Editor
Sara Viewer

Use a custom separator:

Expand Rows

Flatten HasMany relationships so each related record becomes its own row.

Order # Customer Product Qty Price
1001 John Keyboard 1 79.99
1001 John Mouse 2 29.99
1002 Sara Monitor 1 399.99

Nested expand is also supported:

BelongsToMany with Pivot Data

Formatting Values

Download Response

Return a download response directly from a controller. The format is auto-detected from the file extension.

Chunking

Process large datasets in chunks to reduce memory usage.

Exportable Trait

Add the Exportable trait to your model for a convenient shorthand.

Excel Sheets

Custom Sheet Name

Multiple Static Sheets

Dynamic Sheets (One Sheet per Record)

Generate a sheet for each record, with related data as rows.

This creates a sheet per user (named after name), each containing that user's posts.

Use a callback for custom sheet names:

Sheet Meta

Add parent record attributes as header rows above the data table.

Combining Static and Dynamic Sheets

API Reference

Method Description
EloquentExporter::for(Model::class) Create exporter for a model class
EloquentExporter::query($builder) Create exporter from a query builder
->columns(array $columns) Set columns to export (supports dot notation and custom headers)
->format(string $column, Closure $formatter) Apply a formatter callback to a column
->separator(string $column, string $sep) Set separator for HasMany comma-joined values
->expandRows(string $relation) Flatten a HasMany/BelongsToMany into separate rows
->chunk(int $size) Process records in chunks
->sheetName(string $name) Set the Excel sheet name
->addSheet(Builder $query, array $columns, string $name) Add an additional static sheet
->sheetPerRecord(string\|Closure $key) Create one sheet per record
->sheetMeta(array $columns) Add parent record meta rows to dynamic sheets
->addDynamicSheets(Builder $query, Closure $name, array $columns) Add dynamic sheets alongside static ones
->toCsv(string $path) Export to a CSV file
->toExcel(string $path) Export to an Excel (.xlsx) file
->download(string $filename) Return a download response (format auto-detected)

License

MIT


All versions of eloquent-exporter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
phpoffice/phpspreadsheet Version ^1.29|^2.0|^3.0|^4.0|^5.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 phpmystic/eloquent-exporter contains the following files

Loading the files please wait ...