Releases: Knackline/laravel-excel-to-x
2.1.0
Overview
We are excited to announce the release of ExcelTo v2.1! This version brings several improvements, bug fixes, and security enhancements to ensure better performance and code quality. Below are the highlights of this release.
What's New
Features
- Type Hinting: Added type hints for method parameters and return types across the codebase, improving code readability and maintainability.
- File Validation: Enhanced security by validating file paths before processing. The package now checks for file existence, readability, and MIME type, reducing the risk of loading invalid or malicious files.
- Code Refactoring: Removed code duplication by introducing reusable methods, resulting in a cleaner and more maintainable codebase.
Improvements
- Date Handling: Date cells in Excel files are now formatted as
d/m/Y
strings, ensuring consistency across outputs. - Performance Optimization: Improved the efficiency of sheet processing, especially when dealing with multiple sheets within a single file.
Bug Fixes
- Formula Calculation: Fixed an issue where formula cells were returning the formula string instead of the calculated value. Cells now correctly return their computed values.
Upgrade Guide
If you are upgrading from a previous version, follow these steps to update your package:
-
Update via Composer:
composer update knackline/excel-to
-
Update Code:
- If you have overridden any of the package’s methods, ensure your customizations align with the new changes, especially regarding the
processSheet()
method.
- If you have overridden any of the package’s methods, ensure your customizations align with the new changes, especially regarding the
Feedback & Support
We value your feedback! Please report any bugs or issues on our GitHub Issues page.
2.0.0
[v2.0.] - 2024-08-08
Description:
This release introduces two major enhancements to the ExcelTo
class: support for reading multiple sheets from Excel files and a new method for returning data as a PHP array. These improvements increase the flexibility and usability of the ExcelTo
class for handling Excel data in various formats.
New Features:
-
Multiple Sheet Support:
- The
ExcelTo
class can now read and process data from all sheets within an Excel file. - Data is organized by sheet names when there is more than one sheet, allowing easy access to each sheet's content.
- The
-
Array Output:
- Introduced a new method,
array($filePath)
, that returns Excel data as a PHP array. - The array output is structured similarly to the JSON and collection outputs, offering an intuitive way to work with Excel data.
- Introduced a new method,
Changes:
- Refactored Methods:
- The
json($filePath)
andcollection($filePath)
methods have been updated to handle multiple sheets and omit sheet names when there is only one sheet.
- The
Usage:
-
JSON Output:
$jsonOutput = ExcelTo::json('path/to/excel/file.xlsx');
-
Collection Output:
$collectionOutput = ExcelTo::collection('path/to/excel/file.xlsx');
-
Array Output:
$arrayOutput = ExcelTo::array('path/to/excel/file.xlsx');
Documentation:
- Updated documentation to reflect these changes and provide examples for the new features.
Acknowledgments:
- Thanks to all contributors and users for their feedback and support.
Instructions for Creating the Release on GitHub:
- Go to the "Releases" section of your repository on GitHub.
- Click on "Draft a new release."
- Fill in the tag version (e.g.,
v1.1.0
) and target the main branch or the branch containing your changes. - Enter the release title and description using the template above.
- (Optional) Attach any relevant files, such as release notes or compiled binaries.
- Click "Publish release."
This release will make it clear to users what new features and enhancements have been added, and it will provide them with guidance on how to use these features in their projects.
1.2.0
[v1.2.0] - 2024-06-15
Added
-
Date Handling in
json
Method: Updated thejson
method to correctly handle date conversion from Excel. The function now checks if a cell is formatted as a date and converts it to a readable date string (d/m/Y
). This ensures numeric values that are not dates are not mistakenly converted. -
Date Handling in
collection
Method: Similar updates were made to thecollection
method. This ensures that date cells are correctly identified and converted to readable date strings while preserving other numeric values.
Fixed
- Deprecated Method Usage: Replaced deprecated
getCellByColumnAndRow
method with the recommendedgetCell()
method using cell addresses. This change ensures compatibility with the latest version of PhpSpreadsheet and improves code maintainability.
Installation and Upgrade Notes
To upgrade to this version, ensure your composer.json
file specifies the appropriate version for knackline/excel-to-x
and run composer update
.
Contributors
This release improves the handling of Excel date conversions, ensuring data integrity and compatibility with newer versions of dependencies.
Version 1.0.0 (First Release)
Version 1.0.0 (First Release)
Introduction
This is the first official release of the Laravel Excel to JSON / Collection package. This package provides utilities for converting Excel files to JSON format or Laravel Collections.
Installation
You can install the package via Composer:
composer require knackline/excel-to
Usage
JSON Conversion
To convert an Excel file to JSON format, use the json
method of the ExcelTo
class:
use Knackline\ExcelTo\ExcelTo;
$jsonData = ExcelTo::json('path/to/your/excel_file.xlsx');
This will return an associative array representing the Excel data in JSON format.
Collection Conversion
To convert an Excel file to a Laravel Collection, use the collection
method of the ExcelTo
class:
use Knackline\ExcelTo\ExcelTo;
$collection = ExcelTo::collection('path/to/your/excel_file.xlsx');
This will return a Laravel Collection containing the Excel data.
Example
use Knackline\ExcelTo\ExcelTo;
// Convert Excel to JSON
$jsonData = ExcelTo::json('path/to/your/excel_file.xlsx');
// Convert Excel to Collection
$collection = ExcelTo::collection('path/to/your/excel_file.xlsx');
Requirements
- PHP >= 8.2
Author
- RAJKUMAR SAMRA - [email protected] (Github)
Contributing
Contributions are welcome! Feel free to submit pull requests or open an issue if you find any bugs or have any suggestions for improvements.
License
This package is open-source software licensed under the MIT license.
Feel free to customize this release note as needed. Let me know if there's anything else I can help you with!