sylius / import-export-bundle
The ImportExportBundle allows for easy and decoupled data migration to and from various mediums
Fund package maintenance!
sylius
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.2
- doctrine/orm: ^2.18 || ^3.3
- league/csv: ^9.24
- sylius/grid-bundle: ^1.13
- sylius/resource-bundle: ^1.13
- sylius/ui-bundle: ^2.0
- symfony/dependency-injection: ^6.4 || ^7.3
- symfony/framework-bundle: ^6.4 || ^7.3
- symfony/messenger: ^6.4 || ^7.3
- symfony/property-access: ^6.4 || ^7.3
- symfony/serializer: ^6.4 || ^7.3
- symfony/uid: ^6.4 || ^7.3
- symfony/ux-live-component: ^2.12
Requires (Dev)
- phpstan/phpstan: ^1.12
- phpstan/phpstan-doctrine: ^1.5
- phpunit/phpunit: ^10.5
- sylius-labs/coding-standard: ^4.4
- sylius/test-application: *
- webmozart/assert: ^1.11
This package is auto-updated.
Last update: 2025-07-23 08:42:06 UTC
README
Import/Export Bundle
The ImportExportBundle allows for easy and decoupled data migration to and from various mediums.
It works by relying on the Sylius Resource and Grid systems for resolving and providing data.
Features
- Export: Generate data exports in JSON/CSV formats with grid actions
- Import: Import data from JSON files with validation and error handling
- Process Management: Track import/export processes with status monitoring
- Validation: Configurable validation groups for import data
- Async Processing: Background processing via Symfony Messenger (configurable)
Export
Functionality
The main and bulk grid actions get automatically injected into configured resources' grids.
Supported formats:
- json
- csv
Main export action
It respects currently applied filters when exporting resources.
Bulk export action
In cases when specifying filters is not enough, or you want just a subset of the resource, in comes the bulk action.
Processes
Here you can manage currently running and already processed exports as well as download the exported data.
Import
Functionality
The import feature provides a user-friendly way to import data from JSON files directly through the admin interface.
Supported formats:
- json (with plans for additional formats)
Main import action
Import actions are automatically injected into configured resources' grids, allowing administrators to upload and import data files.
Import Process
- File Upload: Upload JSON files through the admin interface
- Validation: Data is validated using configurable validation groups
- Processing: Import runs via Symfony Messenger (synchronously by default, can be configured for async)
- Status Tracking: Monitor import progress and view results
- Error Handling: Failed imports are tracked with detailed error messages
Validation
The import system supports configurable validation groups to ensure data integrity:
- Default validation: Uses entity validation constraints
- Custom validation groups: Configure specific validation rules per resource
- Error reporting: Detailed validation error messages for troubleshooting
Process Management
Import processes are tracked with the following statuses:
processing
: Import is currently runningsuccess
: Import completed successfullyfailed
: Import failed with error details
Installation
Beware!
This installation instruction assumes that you're using Symfony Flex. If you don't, take a look at the legacy installation instruction. However, we strongly encourage you to use Symfony Flex, it's much quicker!
-
Require plugin with composer:
composer require sylius/import-export-bundle
Remember to allow community recipes with
composer config extra.symfony.allow-contrib true
or during plugin installation process -
Apply migrations to your database:
bin/console doctrine:migrations:migrate
-
Configure export and import for resources:
# config/packages/sylius_import_export.yaml sylius_import_export: export: resources: sylius.order: ~ app.brand: serialization_group: 'app:brand:export' sections: - 'Sylius\Bundle\AdminBundle\SectionResolver\AdminSection' provider: 'sylius_import_export.provider.resource_data.orm' import: resources: sylius.order: ~ app.brand: validation_groups: ['Default', 'import']
For a more detailed overview check the configuration reference.
File Storage
Export Files
By default, when a resource gets exported, a file is saved on the server. The save directory is specified
with the %sylius_import_export.export_files_directory%
parameter, that can be overridden if needed.
Import Files
Import files are temporarily stored on the server during processing. The save directory is specified
with the %sylius_import_export.import_files_directory%
parameter, that can be overridden if needed.
Both file directories can be configured:
# config/packages/sylius_import_export.yaml sylius_import_export: export: files_directory: '%kernel.project_dir%/var/export' import: files_directory: '%kernel.project_dir%/var/import' file_max_size: '50M' allowed_mime_types: ['application/json']
Note: Large file uploads may require adjusting PHP configuration:
# php.ini upload_max_filesize = 50M post_max_size = 50M
Security issues
If you think that you have found a security issue, please do not use the issue tracker and do not post it publicly.
Instead, all security issues must be sent to security@sylius.com
.