1. Go to this page and download the library: Download sigwin/xezilaires-dev library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sigwin / xezilaires-dev example snippets
class Product
{
private $name;
}
$symfonySerializer = new \Symfony\Component\Serializer\Serializer([
new \Symfony\Component\Serializer\Normalizer\PropertyNormalizer(),
]);
$normalizer = new \Xezilaires\Bridge\Symfony\Serializer\ObjectSerializer($symfonySerializer);
$iteratorFactory = new \Xezilaires\SpreadsheetIteratorFactory($normalizer, [
\Xezilaires\Bridge\PhpSpreadsheet\Spreadsheet::class,
]);
$iterator = $iteratorFactory->fromFile(
// https://github.com/sigwinhq/xezilaires-dev/raw/master/src/Xezilaires/Test/resources/fixtures/products.xlsx
new \SplFileObject(__DIR__.'/../../src/Xezilaires/Test/resources/fixtures/products.xlsx'),
new \Xezilaires\Metadata\Mapping(
Model\Product::class,
[
'name' => new \Xezilaires\Metadata\ColumnReference('A'),
],
[
// options
'start' => 2,
]
)
);
use Xezilaires\Attribute as XLS;
#[XLS\Options(header=1, start=2)]
class Product
{
#[@XLS\HeaderReference(header="Name")]
private $name;
}
$symfonySerializer = new \Symfony\Component\Serializer\Serializer([
new \Symfony\Component\Serializer\Normalizer\PropertyNormalizer(),
]);
$normalizer = new \Xezilaires\Bridge\Symfony\Serializer\ObjectSerializer($symfonySerializer);
$iteratorFactory = new \Xezilaires\SpreadsheetIteratorFactory($normalizer, [
\Xezilaires\Bridge\PhpSpreadsheet\Spreadsheet::class,
]);
$attributeDriver = new \Xezilaires\Metadata\Attribute\AttributeDriver();
$iterator = $iteratorFactory->fromFile(
// https://github.com/sigwinhq/xezilaires-dev/raw/master/src/Xezilaires/Test/resources/fixtures/products.xlsx
new \SplFileObject(__DIR__.'/../../src/Xezilaires/Test/resources/fixtures/products.xlsx'),
$attributeDriver->getMetadataMapping(Product::class, ['reverse' => true])
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.