PHPackages                             hugoseigle/symfony-import-export-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. hugoseigle/symfony-import-export-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

hugoseigle/symfony-import-export-bundle
=======================================

Import and export Doctrine entities from Excel and CSV in Symfony applications.

v2.1.1(2w ago)958MITPHPPHP &gt;=8.1CI passing

Since Oct 30Pushed 2w ago1 watchersCompare

[ Source](https://github.com/HugoSEIGLE/symfony-import-export-bundle)[ Packagist](https://packagist.org/packages/hugoseigle/symfony-import-export-bundle)[ RSS](/packages/hugoseigle-symfony-import-export-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (6)Dependencies (34)Versions (8)Used By (0)

Symfony Import Export Bundle
============================

[](#symfony-import-export-bundle)

Import and export Doctrine entities from Excel and CSV in Symfony applications.

[![Tests](https://github.com/HugoSEIGLE/symfony-import-export-bundle/actions/workflows/test.yaml/badge.svg)](https://github.com/HugoSEIGLE/symfony-import-export-bundle/actions/workflows/test.yaml)[![Latest stable version](https://camo.githubusercontent.com/808955b14ce6c77143b6f6c154b8b32ec2c3344a662feda6ad4db6412b8eeeda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6875676f736569676c652f73796d666f6e792d696d706f72742d6578706f72742d62756e646c653f6c6162656c3d737461626c65)](https://packagist.org/packages/hugoseigle/symfony-import-export-bundle)[![Total downloads](https://camo.githubusercontent.com/c2b4c99057a717b416b17fd1a9afda1f38a31b1872afcd56dcb4416aaf23cda8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6875676f736569676c652f73796d666f6e792d696d706f72742d6578706f72742d62756e646c653f6c6162656c3d646f776e6c6f616473)](https://packagist.org/packages/hugoseigle/symfony-import-export-bundle/stats)[![Monthly downloads](https://camo.githubusercontent.com/a97f6822d9a1fce7642aeb87dc3df6d91de58ec2ba067aa5e1c742a1c546153e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6875676f736569676c652f73796d666f6e792d696d706f72742d6578706f72742d62756e646c653f6c6162656c3d6d6f6e74686c79)](https://packagist.org/packages/hugoseigle/symfony-import-export-bundle/stats)[![GitHub stars](https://camo.githubusercontent.com/4f3056fcbe924c5cfb6c53667e163b3cb5a3e33464e1b61d5b0cf9582bbf832d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4875676f534549474c452f73796d666f6e792d696d706f72742d6578706f72742d62756e646c653f7374796c653d666c6174)](https://github.com/HugoSEIGLE/symfony-import-export-bundle/stargazers)[![Latest release](https://camo.githubusercontent.com/21d9714a290148807142b344b141a0b46b0a8b3d9b06b1abb498057b209466fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f4875676f534549474c452f73796d666f6e792d696d706f72742d6578706f72742d62756e646c653f6c6162656c3d72656c65617365)](https://github.com/HugoSEIGLE/symfony-import-export-bundle/releases)[![License](https://camo.githubusercontent.com/7ad0926ec699b5478158d17bc884ced267bc753fea01b9a3d179de88ea27de59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6875676f736569676c652f73796d666f6e792d696d706f72742d6578706f72742d62756e646c65)](LICENSE)

[![Symfony Import Export Bundle demo](docs/images/demo.png)](docs/images/demo.png)

Features
--------

[](#features)

- Streamed CSV export and CSV/XLSX import and export.
- Ordered, translated headers and downloadable import templates.
- Symfony Form validation and data transformation for every imported row.
- Doctrine metadata conversion for booleans, dates, backed enums, and associations.
- Create, update, and optional delete candidates identified by configured unique fields.
- Structured row errors without automatic database writes.
- Configurable date, boolean, CSV, BOM, and strict-header behavior.

Requirements
------------

[](#requirements)

- PHP 8.1 or newer
- Symfony 6.4, 7.x, or 8.x
- Doctrine ORM 3.2 or newer within 3.x
- PhpSpreadsheet 2.3.5 or newer within 2.x

Installation
------------

[](#installation)

```
composer require hugoseigle/symfony-import-export-bundle
```

Bundle activation
-----------------

[](#bundle-activation)

Symfony Flex normally registers bundles. If it does not, add:

```
// config/bundles.php
return [
    HugoSEIGLE\SymfonyImportExportBundle\SymfonyImportExportBundle::class => ['all' => true],
];
```

Minimal configuration
---------------------

[](#minimal-configuration)

```
# config/packages/import_export.yaml
import_export:
    date_format: 'Y-m-d'
    importers:
        App\Entity\Company:
            fields: [name, email, active]
            unique_fields: [email]
```

Field order is column order. Strict header validation is enabled by default. See [installation](docs/installation.md) for all requirements.

First export
------------

[](#first-export)

Inject `ExporterInterface`, pass it a Doctrine ORM `Query`, getter names in column order, a base filename, and a format:

```
use HugoSEIGLE\SymfonyImportExportBundle\Services\Export\ExporterInterface;

$query = $companyRepository->createQueryBuilder('company')->getQuery();

return $exporter->export(
    $query,
    ['getName', 'getEmail', 'isActive'],
    'companies',
    ExporterInterface::CSV, // or ExporterInterface::XLSX
);
```

CSV rows stream from `Query::toIterable()`. XLSX iterates the query but retains workbook cells in memory. See [exporting](docs/export.md).

First import
------------

[](#first-import)

Create a Symfony form type containing every configured field, then pass an uploaded `.csv` or `.xlsx` file to `ImporterInterface`:

```
use App\Entity\Company;
use App\Form\CompanyImportType;
use HugoSEIGLE\SymfonyImportExportBundle\Services\Import\ImporterInterface;

$result = $importer->import(
    $uploadedFile,
    Company::class,
    CompanyImportType::class,
);
```

The result exposes `getCreatedEntities()`, `getUpdatedEntities()`, and `getDeletedEntities()`. The bundle does not persist, remove, flush, or start a transaction; your application decides whether and how to apply candidates. See [importing](docs/import.md).

Validation and error handling
-----------------------------

[](#validation-and-error-handling)

```
use HugoSEIGLE\SymfonyImportExportBundle\Services\Import\ImportError;

if (!$result->isValid()) {
    $errors = array_map(static fn (ImportError $error): array => [
        'row' => $error->row,
        'field' => $error->field,
        'message' => $error->message,
        'value' => $error->value,
    ], $result->getErrors());
}
```

Header mismatches stop the import. Row errors accumulate while later rows continue. Persist only after applying your chosen all-or-partial import policy; [validation guidance](docs/validation.md) shows the relevant edge cases.

Supported formats
-----------------

[](#supported-formats)

OperationCSVXLSXImportYesYesExportYesYesEmpty import templateYesYesOnly `.csv` and `.xlsx` imports are implemented. CSV is expected to be UTF-8; a first-header BOM is accepted. XLSX formulas are read from stored values without formula evaluation.

Customization
-------------

[](#customization)

Configure global date/boolean formatting, strict headers, CSV delimiter/enclosure/escape/BOM, entity fields, unique fields, and deletion:

```
import_export:
    bool_true: 'yes'
    bool_false: 'no'
    validate_headers: true
    csv:
        delimiter: ';'
        enclosure: '"'
        escape: ''
        bom: true
    importers:
        App\Entity\Company:
            fields: [name, email, active]
            unique_fields: [email]
            allow_delete: true
```

The optional `deleted` column is added only with `allow_delete: true`. Per-call `allowDelete`, `allowCreate`, and `allowUpdate` flags can further restrict operations. Headers use `import_export.` keys from the application `messages` translation domain. See [customization](docs/customization.md).

Extension points
----------------

[](#extension-points)

The bundle dispatches no events. Extend behavior through Symfony form constraints and transformers, translations, runtime operation flags, configuration, or service decoration. `MethodToSnakeInterface`, `ExporterInterface`, `ImporterInterface`, and `ImporterTemplateInterface` are autowireable.

Generate a translated empty file with:

```
return $templates->getImportTemplate(Company::class, ImporterInterface::XLSX);
```

Demo
----

[](#demo)

The [`demo/`](demo/) directory is a complete Symfony application backed by SQLite. It installs this bundle from the parent directory and demonstrates imports, validation feedback, downloadable templates, and CSV/XLSX exports.

```
cd demo
composer install
composer setup
symfony serve
```

Then open the URL printed by Symfony CLI. A ready-to-import [`companies.csv`](demo/data/companies.csv) file is included. The smaller [Company example](examples/README.md) remains available for copying individual files into an existing application.

Compatibility
-------------

[](#compatibility)

BundlePHPSymfonyDoctrine ORMPhpSpreadsheet2.x&gt;= 8.16.4 / 7.x / 8.x&gt;= 3.2, &lt; 4.0&gt;= 2.3.5, &lt; 3.0Composer also enforces each Symfony release's own PHP requirement. Version 1.x users must follow the [upgrade guide](docs/upgrading.md), especially for the canonical `HugoSEIGLE\SymfonyImportExportBundle` namespace and result-based import API.

Tests and quality
-----------------

[](#tests-and-quality)

```
composer validate --strict
composer dump-autoload --optimize --strict-psr
composer test
composer lint
composer phpstan
```

CI runs supported PHP/Symfony combinations. `composer lint` is read-only.

Contributing
------------

[](#contributing)

Bug reports and focused pull requests are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting changes.

License
-------

[](#license)

Released under the [MIT License](LICENSE).

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance97

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~107 days

Recently: every ~134 days

Total

7

Last Release

14d ago

Major Versions

1.1.0 → v2.0.12026-07-13

PHP version history (3 changes)1.0.0PHP &gt;=8.1

v1.0.1PHP &gt;=8.3

1.1.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/102899493?v=4)[Hugo Seigle](/maintainers/HugoSEIGLE)[@HugoSEIGLE](https://github.com/HugoSEIGLE)

---

Top Contributors

[![HugoSEIGLE](https://avatars.githubusercontent.com/u/102899493?v=4)](https://github.com/HugoSEIGLE "HugoSEIGLE (25 commits)")

---

Tags

bundlecsvdoctrineexcelexportimportphpphpspreadsheetspreadsheetsymfonysymfony-bundlexlsxsymfonyexportdoctrineexcelcsvspreadsheetimportSymfony Bundle

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hugoseigle-symfony-import-export-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/hugoseigle-symfony-import-export-bundle/health.svg)](https://phpackages.com/packages/hugoseigle-symfony-import-export-bundle)
```

###  Alternatives

[kimai/kimai

Kimai - Time Tracking

4.8k9.4k1](/packages/kimai-kimai)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1617.3k16](/packages/2lenet-crudit-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M777](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M430](/packages/easycorp-easyadmin-bundle)[contao/core-bundle

Contao Open Source CMS

1301.7M3.1k](/packages/contao-core-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

12017.1k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
