kunicmarko/sonata-importer-bundle
A Symfony bundle that adds configurable data import to Sonata Admin. Define importers for CSV or XML files, map columns to entity fields, and run imports from the admin interface with validation and error handling.
composer.json (or composer show kunicmarko/sonata-importer-bundle --all) and read the actual constraints. The prior assumption of a hard 3.4–4.x / Sonata 3.x ceiling may or may not still hold; the release notes are terse enough that you should confirm before planning anything.composer require kunicmarko/sonata-importer-bundle. 0.1.3 specifically fixes "unable to install correctly when using Symfony Flex", so on a Flex app the bundle should now be registered automatically. If config/bundles.php still doesn't list it after install, you're either not on Flex or hit the old bug — register it by hand and check composer why for a stale lockfile. Non-Flex apps still register manually as before.config/packages/*sonata_importer* file before writing your own — and diff it against the README so you don't duplicate settings in the wrong place.src/Importer/ (the interface/abstract class you implement), then the compiler pass that collects tagged importer services, then the admin extension/controller adding the "Import" action. Note the release-note line "dependency used changed how they handle stuff" — something behind the compiler pass or the admin extension changed behaviour upstream, and 0.1.3 is the adaptor. If you're upgrading an existing install, diff src/ between the two tags rather than assuming the architecture is identical.AbstractImporter (or implement ImporterInterface), put parsing/persistence in import(), register as a service with the bundle's tag whose alias matches the admin service id. If the alias doesn't resolve, the Import button silently won't appear.composer update, and commit composer.lock in the same change; then re-test the "Import" button and the tag resolution on a non-production environment.app:import:products {file} calling the same importer keeps big files and nightly syncs out of a web request.[line => message], continue. Return a summary (created / updated / skipped / failed) instead of throwing on the first bad row.flush() + clear() every ~100–500 rows. Flushing per row is the usual reason a 20k-line import times out.league/csv, PhpSpreadsheet) with a fixed column map; the importer depends on an array of rows. Swapping CSV→XLSX costs one class.tests/fixtures/products.csv plus assertions on created/updated counts covers most of the risk; add a functional test that POSTs the import form — that's also your regression net for the 0.1.3 wiring changes.composer require "succeeds" but the bundle isn't in config/bundles.php and the Import button never appears, clear the Flex cache (rm -rf var/cache/*), confirm the plugin is enabled in composer.json (symfony/flex), and retry on a clean vendor. Don't start hand-wiring services before you've confirmed which of the two paths you're on.composer why <suspect-package> / git diff the tag and retest your importer registration and admin extension before deploying.composer.json remains cheap insurance if constraints block your Symfony/Sonata version.bin/console debug:container --tag=<bundle tag> and confirm the action is registered on the admin's routes/available actions.isGranted('EDIT') (or a dedicated role), enforce a max size, validate extension/MIME. Sonata's ACL doesn't automatically cover a custom action.multipart/form-data — a custom template that drops form_enctype is a classic silent failure.; vs , matches expectations (Excel uses the OS locale separator). Detect the delimiter or force it in config.set_time_limit(0) and a raised memory_limit for CLI/cron paths; keep the web path small or defer it.translations/ rather than editing vendor files.How can I help you explore Laravel packages today?