- How do I install rich-id/excel-generator-bundle in a Laravel project?
- Install it with Composer using composer require rich-id/excel-generator-bundle. The package is described as framework-friendly with service wiring for Laravel/PHP projects, so expect a service provider or container-resolvable factory depending on the version. After installation, check the README and composer.json for the exact Laravel and PHP constraints before wiring it into controllers or jobs.
- Can rich-id/excel-generator-bundle handle large Excel exports without running out of memory?
- The package overview advertises streamed downloads suitable for large exports, which is the right design for big reports. However, the release notes do not document whether the ExcelResponseFactory streams row-by-row or builds the full workbook in memory. Test with realistic row counts and set a memory ceiling before relying on it for high-volume exports.
- Which underlying Excel writer does this package use, PhpSpreadsheet, Laravel Excel, or OpenSpout?
- The provided documentation does not name the underlying writer. Based on the feature set, it is most likely a thin adapter over PhpSpreadsheet, Maatwebsite/Laravel Excel, or a lightweight writer such as OpenSpout. Inspect composer.json and the vendor directory to confirm the dependency chain and required PHP extensions such as ext-zip or ext-gd.
- Can I export Eloquent query results or arrays directly to .xlsx with this bundle?
- Yes, the package is described as data-source agnostic and works with arrays, Eloquent results, or iterators. You define sheets, headers, columns, and rows through fluent builders, then return a downloadable response. For very large queries, use chunking or lazy collections so the data source does not become the memory bottleneck.
- How do I format headers, column widths, and cell styles in rich-id/excel-generator-bundle?
- The fluent API includes styling support for headers, cell formats, and column widths. You configure these through the workbook, sheet, column, or row builders rather than writing low-level spreadsheet code. Keep styling rules near the sheet definition and avoid putting presentation logic inside domain services.
- Does rich-id/excel-generator-bundle protect against Excel formula injection?
- The documentation provided does not confirm whether cell values are sanitised against formula injection. Spreadsheet exports are a known injection vector when values begin with =, +, -, or @, so treat this as an open finding until you verify the behaviour. If it is not handled by default, neutralise formula-like strings before passing data to the builder.
- What Laravel and PHP versions are required by rich-id/excel-generator-bundle?
- The package is described as presupposing a modern Laravel 8+ container and PHP 8.x, but the exact constraints are not listed in the supplied overview. Always read the composer.json require block and the README compatibility section before upgrading. Older Laravel or PHP versions should be treated as unsupported unless the maintainers state otherwise.
- How can I test an Excel download response in Laravel?
- If the package returns a standard Laravel response through the ExcelResponseFactory, you can use the usual HTTP test helpers such as $this->get(...)->assertDownload(). Assert the filename, status code, and content type, and add a unit test around the builder output where possible. This keeps the transport boundary tested without coupling tests to spreadsheet internals.
- Is ExcelResponseFactory stateless and safe to inject into controllers?
- Architecturally, a response factory should be a stateless adapter at the transport boundary, produced by the container and injected as a single dependency. The release notes do not confirm whether this implementation is stateless or expects static/global configuration. Review the source before injecting it broadly, and avoid letting it absorb query execution or presentation logic.
- How does rich-id/excel-generator-bundle compare with Maatwebsite/Laravel Excel, and is it production-ready?
- It offers a lighter, fluent builder-style alternative for straightforward .xlsx exports, but it is a young 1.x package with limited public evidence and a single-line changelog for the ExcelResponseFactory addition. There is no supplied adoption data or published deprecation policy. Treat it as an unvetted dependency until you review the maintainer activity, dependency weight, and streaming behaviour.