Download the PHP package maymeow/excel-importer without Composer
On this page you can find all versions of the php package maymeow/excel-importer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maymeow/excel-importer
More information about maymeow/excel-importer
Files in maymeow/excel-importer
Package excel-importer
Short Description A php package to transform XLSX filse to models.
License MIT
Homepage https://github.com/MayMeow/excel-importer
Informations about the package excel-importer
Excel importer
Simple and extendable library for loading data from Excel files (.xlsx) into objects.
This Library using phpoffice/phpspreadsheet
to read from XLSX files. Look at their Github
Read files - commandline with example data (Deprecated)
From command line with example data
Via Source Code
Create new model which extending MayMeow\ExcelImporter\Models\BaseModel
. To map column from excel to property use
\MayMeow\ExcelImporter\Attributes\Column
attribute.
read from file following example is reading from active sheet
Validators :tada: (from v1.2.0)
I added option to validate input data before you store them to the target. It uses new class from namespace MayMeow\ExcelImporter\Validators;
. Validator using attributes (rules) to validate fi data in field (property are valid). In current state (v1.2.0) i shipping only NotEmpty
rule for validation.
For example
Then you can use validator to validate the data as follows:
Error bag
This is how validation working. It uses ValidatorErrorBag
to store errors. If you want implement your own validator but use error bag you can do this as follows:
Custom rules (attributes)
If you want to create new rule, you can do this by creating new attribute. That new attribute must implement MayMeow\ExcelImporter\Validators\ValidatorAttributeInterface;
to make it work.
Validator only look for property applied Attributes.
Files
For getting path to files you can create Locator by implementing MayMeow\ExcelImporter\Tools\FileLocatorInterface
which
is not required by XLS reader but recommended.
License MIT
All versions of excel-importer with dependencies
symfony/console Version ^5.1
php Version 8.*
meow/hydrator Version ^1.0