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.
- 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)
The main and bulk grid actions get automatically injected into configured resources' grids.
Supported formats:
- json
- csv
It respects currently applied filters when exporting resources.
In cases when specifying filters is not enough, or you want just a subset of the resource, in comes the bulk action.
Here you can manage currently running and already processed exports as well as download the exported data.
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)
Import actions are automatically injected into configured resources' grids, allowing administrators to upload and import data files.
- 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
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
Import processes are tracked with the following statuses:
processing: Import is currently runningsuccess: Import completed successfullyfailed: Import failed with error details
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 trueor 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 imports: - { resource: "@SyliusImportExportBundle/config/config.yaml" } sylius_import_export: export: resources: sylius.order: ~ app.brand: serialization_groups: ['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.
-
Configure routes:
# config/routes/sylius_import_export.yaml imports: resource: "@SyliusImportExportBundle/config/routes.yaml"
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 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 = 50MIf 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 [email protected].


