- Can I use SonataExporter with Laravel 10 or 11 for CSV/JSON exports?
- Yes, SonataExporter fully supports Laravel 10/11 due to its Symfony 7.x/8.x alignment. Install via Composer (`sonata-project/exporter`) and leverage Eloquent/Collections directly. No additional Laravel-specific setup is required beyond PHP 8.2+.
- What happens if I’m still on PHP 8.1 with Laravel 9?
- This release drops PHP 8.1 support, so it won’t work with Laravel 9. Upgrade to PHP 8.2+ or consider alternatives like `spatie/laravel-exports` (PHP 8.0+). Audit dependencies with `composer why-not php:^8.2` to identify blockers.
- How do I export large Eloquent datasets without memory issues?
- Use SonataExporter’s iterators and writers to stream data incrementally. For Eloquent, chain `cursor()` to avoid loading all records at once. Example: `$users->cursor()->each(fn($user) => $exporter->addRow($user->toArray()))`.
- Does SonataExporter support Excel (XLS/XLSX) exports?
- No, SonataExporter doesn’t include Excel support. For XLS/XLSX, pair it with `PhpOffice/PhpSpreadsheet` manually or use `maatwebsite/excel`, which offers built-in Excel features and Laravel integration.
- Will this break if I use Doctrine DBAL <4.0 in Laravel?
- Yes, this release requires Doctrine DBAL 4+. If you’re on an older version, test thoroughly for regressions or upgrade DBAL first. For Laravel apps using `spatie/laravel-doctrine-orm`, ensure compatibility with Doctrine 4.
- Can I integrate SonataExporter with Laravel Queues for async exports?
- No, SonataExporter lacks native queue support. Manually dispatch a job (e.g., `ExportDataJob`) that uses the exporter, then return a download link or notification. Example: `dispatch(new ExportDataJob($data))->onQueue('exports').`
- What are the best alternatives if SonataExporter isn’t compatible?
- For PHP 8.0+ Laravel apps, consider `spatie/laravel-exports` (active maintenance, queue support) or `maatwebsite/excel` (Excel-focused, feature-rich). Both integrate seamlessly with Eloquent and Collections.
- How do I handle special characters or BOM issues in CSV/JSON exports?
- SonataExporter doesn’t auto-handle BOM or encoding. Manually configure the writer’s charset (e.g., `new CsvWriter($stream, 'UTF-8')`) and validate edge cases. Test with `mb_detect_encoding()` for non-ASCII data.
- Does SonataExporter work with Symfony components outside Laravel?
- Yes, but Symfony 8.x is now required, which may conflict with older Symfony 7.x components. Audit your stack for version mismatches using `composer why symfony/*`. Replace or update conflicting packages first.
- How do I migrate from an older SonataExporter version to this release?
- Start by upgrading PHP to 8.2+. Replace any Symfony 7.x components with 8.x equivalents. Test Doctrine DBAL 4 if used, then gradually replace export logic. Use `composer update sonata-project/exporter` after verifying dependencies.