- How do I install shuchkin/simplexlsx in a Laravel application?
- Install it with Composer using composer require shuchkin/simplexlsx. There is no Laravel service provider or bootstrap step, so you can use the SimpleXLSX class directly after autoloading. In a Laravel app, wrap it in your own service or adapter if you want testability and a swappable parser.
- Which Laravel and PHP versions does SimpleXLSX support?
- SimpleXLSX is framework-agnostic and has no Laravel-specific version constraints. It relies on core PHP extensions such as zip and XML/SimpleXML, so the practical requirement is a PHP runtime that meets the package's declared composer.json constraints. Check that declared PHP range against your Laravel runtime matrix and pin an exact version in the lockfile.
- How do I read an uploaded XLSX file in Laravel with SimpleXLSX?
- Store or locate the uploaded file, then call SimpleXLSX::parse() with a real filesystem path. The parser returns worksheet rows as PHP arrays, so you normally treat the first row as headers and map subsequent rows yourself. Keep upload validation, size limits, and virus scanning outside the parser.
- Can SimpleXLSX read .xls, .ods, or CSV files?
- No. SimpleXLSX reads only .xlsx files, the Excel 2007+ OOXML format. It does not handle legacy .xls, .ods, or CSV. If users can upload those formats, add separate readers behind your own spreadsheet-reader interface.
- Does SimpleXLSX calculate formulas or return cached values?
- SimpleXLSX does not evaluate formulas. It returns the cached values stored in the workbook, which is usually what Excel last saved. If a cell has no cached result, or if business users expect recalculation on import, you need a different tool or an explicit recalculation step.
- How should I handle Excel dates with SimpleXLSX?
- Excel stores dates as serial numbers, and SimpleXLSX does not give you typed domain date objects by default. Convert values explicitly using a documented base date, and account for Excel's 1900 leap-year quirk and your application's timezone rules. Test edge cases such as formatted date strings, empty date cells, and time-only values rather than inferring from a successful parse.
- Is SimpleXLSX safe for untrusted user uploads in production?
- Treat every uploaded .xlsx as untrusted input. Apply hard file-size caps, per-process memory limits, queue isolation, and timeouts to reduce zip-bomb and shared-strings memory risks. Also verify that the XML parsing path disables external entity loading and network access instead of assuming it does.
- How do I process large XLSX files without exhausting memory with SimpleXLSX?
- Memory use is often dominated by the shared-strings table, so a small sample file does not predict behavior on a large export. Enforce upload size caps, set a realistic memory_limit per worker, and run imports in isolated queue jobs with timeouts. If you must support very large workbooks, evaluate a streaming reader rather than loading everything in a web request.
- Is there a Laravel service provider or facade for SimpleXLSX?
- There is no Laravel service provider, config file, or facade in SimpleXLSX. That is intentional: it is a plain PHP class with no framework coupling. You own the integration glue, so put it behind an internal interface such as SpreadsheetReader if you want to swap parsers later.
- What are alternatives to SimpleXLSX for Excel imports in Laravel?
- PhpSpreadsheet is the common heavier alternative when you need writing, .xls/.ods support, or formula calculation. Streaming options such as Spout/OpenSpout are better suited to very large files and memory-sensitive imports. SimpleXLSX remains a good fit when you only need lightweight read-only .xlsx parsing inside a bounded ingestion pipeline.