Download the PHP package ecourty/doctrine-export-bundle without Composer

On this page you can find all versions of the php package ecourty/doctrine-export-bundle. 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 doctrine-export-bundle

Doctrine Export Bundle

CI

A flexible and extensible Symfony bundle for exporting Doctrine entities to various formats (CSV, JSON, XML).

Compatible with PHP 8.3+, Symfony 7.x/8.x, and Doctrine ORM 3.x/4.x 🎉

📖 Table of Contents

Installation

If you're not using Symfony Flex, enable the bundle manually:

Quick Start

Export entities in a few lines:

That's it! 🚀

✨ Key Features

Performance

Benchmarked with realistic dataset (10,000 entities, 15 fields):

Format Time (10k entities) Memory Usage Throughput
CSV 0.274s 2.00 MB 36,496 ent/s
JSON 0.238s < 0.1 MB 42,017 ent/s
XML 0.314s < 0.1 MB 31,847 ent/s
Generator 0.305s < 0.1 MB 32,787 ent/s

Tested: 10,000 entities × 15 fields = 150,000 data points

Linear scaling: tested with 100,000 entities in ~2.5s with < 5 MB memory 🚀

Usage

Basic Export to File

Streaming Export (Binary Response)

Simply pass the generator to a StreamedResponse:

Events

The bundle dispatches events before and after each export, allowing you to hook into the export lifecycle for logging, monitoring, or custom logic.

Events are optional - if no event dispatcher is configured, exports work normally without events.

The bundle uses the PSR-14 EventDispatcherInterface (Psr\EventDispatcher\EventDispatcherInterface), making it compatible with any PSR-14 compliant event dispatcher, not just Symfony's.

Available Events

Example: Logging Exports

Example: Performance Monitoring

Event Properties

PreExportEvent:

PostExportEvent:

Supported Formats

Format Extension Description Use Case
CSV .csv Comma-separated values Spreadsheets, Excel
JSON .json JSON format APIs
XML .xml XML with configurable structure Legacy enterprise systems

Format Examples

Advanced Options

Custom Entity Processors

Implement custom data transformations with entity processors. They allow you to modify exported data, add virtual fields, or apply business logic during export.

Creating a Custom Processor

Using Processors

Adding Virtual Fields

Chaining Multiple Processors

Processors are executed in order, allowing you to compose transformations:

Performance Optimization: Disable Default Processor

When using a fully custom processor that handles all data extraction, disable the default processor for better performance:

Note: The default processor handles property access, associations, and data normalization. Only disable it when your custom processor fully replaces this functionality.

Field Selection

You can specify which fields to export. If not specified, all entity fields are exported:

Note: Field names are validated against the entity metadata. If you specify a field that doesn't exist, an InvalidCriteriaException will be thrown.

Export Options

Available Options

Option Type Default Description
OPTION_BOOLEAN_TO_INTEGER bool true Convert boolean values to integers (1/0) instead of strings ('true'/'false')
OPTION_DATETIME_FORMAT string DateTimeInterface::ATOM PHP date format for DateTime fields (e.g., 'Y-m-d H:i:s', 'c')
OPTION_NULL_VALUE string\|int\|float null Custom representation for null values (e.g., 'NULL', 'N/A', '')
OPTION_STRICT_FIELDS bool false Throw exception if a requested field doesn't exist on the entity
OPTION_DISABLE_DEFAULT_PROCESSOR bool false Skip default processor when using custom processors that handle all processing

Field Validation

The bundle automatically validates that fields in criteria and orderBy exist in the entity. If an invalid field is specified, an InvalidCriteriaException will be thrown with a helpful error message listing all available fields.

Memory Management

The bundle uses streaming and entity detachment for automatic memory efficiency:

How it works:

Why no batching? This bundle doesn't need batch processing because:

Association Handling

Doctrine associations are automatically exported as primary keys:

How it works:

Benefits:

Development

Quality Assurance

Run all quality checks:

Individual commands:

Requirements

License

MIT


All versions of doctrine-export-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-xmlwriter Version *
symfony/config Version ^7.0|^8.0
symfony/dependency-injection Version ^7.0|^8.0
symfony/http-kernel Version ^7.0|^8.0
symfony/property-access Version ^7.0|^8.0
doctrine/orm Version ^3.0|^4.0
doctrine/doctrine-bundle Version ^2.18|^3.1
psr/event-dispatcher Version ^1.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 ecourty/doctrine-export-bundle contains the following files

Loading the files please wait ...