Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Phpspreadsheet

Phpspreadsheet Laravel Package

phpoffice/phpspreadsheet

PhpSpreadsheet is a pure-PHP library to read and write spreadsheet files like Excel and LibreOffice Calc. Create, modify, and export workbooks across multiple formats with a rich API, documentation, and active community support.

View on GitHub
Deep Wiki
Context7

PhpSpreadsheet is a pure-PHP library for reading and writing spreadsheet files, including Microsoft Excel and LibreOffice Calc formats. It provides a rich object model for generating reports, importing data, and manipulating workbooks in PHP apps.

Built and maintained by PHPOffice, it targets modern PHP (minimum PHP 8.1) and includes extensive guides and API references via the official documentation.

  • Read/write multiple spreadsheet formats (e.g., XLSX, ODS, more)
  • Create and modify workbooks, worksheets, cells, and formulas
  • Apply styling, formatting, and data validation
  • Import/export for reporting, ETL, and data interchange
  • Active maintenance with CI, coverage, and community support
Frequently asked questions about Phpspreadsheet
How do I install PhpSpreadsheet in a Laravel project?
Run `composer require phpoffice/phpspreadsheet` in your Laravel project directory. The package requires PHP 8.1+ and integrates seamlessly with Laravel’s autoloader. No additional Laravel-specific setup is needed beyond the core installation.
Does PhpSpreadsheet support Laravel’s Excel imports (e.g., Excel::import())?
Yes, PhpSpreadsheet works with Laravel Excel packages like maatwebsite/excel. It powers the underlying spreadsheet operations, including reading/writing XLSX, CSV, and ODS files. Check the Laravel Excel docs for integration examples.
What Laravel versions are compatible with PhpSpreadsheet?
PhpSpreadsheet supports Laravel 8.x, 9.x, and 10.x, as it requires PHP 8.1+. For Laravel 10.x, ensure your codebase handles type-strictness (e.g., scalar type declarations) to avoid issues with dynamic type handling in the library.
How do I handle large spreadsheets in Laravel without memory issues?
Use Laravel’s queue system (e.g., `dispatch()`) to process large files asynchronously. PhpSpreadsheet’s benchmarking tools can help identify bottlenecks, and chunking data (e.g., reading rows in batches) reduces memory spikes during export.
Are there security risks when processing user-uploaded Excel files?
Yes, validate user-uploaded files with Laravel’s input sanitization (e.g., reject files with malicious formulas like `=XLOOKUP()` on untrusted ranges). PhpSpreadsheet’s Data URI fixes reduce XSS risks from embedded images, but always sanitize dynamic content.
What’s the difference between PhpSpreadsheet and PhpExcel (legacy)?
PhpSpreadsheet is the modern successor to PhpExcel, offering better performance, PHP 8.1+ support, and features like XLOOKUP, CSV reader extensibility, and ODS integer style fixes. It’s actively maintained with CI/CD and community support.
How do I customize CSV imports in Laravel using PhpSpreadsheet?
Use the new `Reader/CsvNoEscape` class for custom CSV parsing (e.g., handling malformed delimiters). Extend Laravel’s Excel imports by injecting PhpSpreadsheet’s CSV reader into your service container for advanced control.
Does PhpSpreadsheet support dynamic formulas like XLOOKUP in Laravel?
Yes, PhpSpreadsheet includes XLOOKUP and union argument fixes. However, validate user-generated formulas in Laravel’s request pipeline to prevent circular references or invalid ranges, especially in financial or reporting workflows.
How do I test PhpSpreadsheet in a Laravel CI pipeline?
Integrate PhpSpreadsheet’s benchmarking tools into Laravel’s testing suite to measure performance. Use Laravel’s `Artisan` commands to generate test spreadsheets and validate exports/imports with PHPUnit assertions.
What are the deprecated features in PhpSpreadsheet, and how do I migrate?
Deprecated constants like `MAX_XLS_COLUMN` should be replaced with `AddressRange` equivalents. Audit your Laravel codebase for hardcoded spreadsheet dimensions or custom CSV readers relying on the old `Reader/Csv` class and update them.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
redaxo/debug
redaxo/test
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder