{"id":18482029,"url":"https://github.com/sigwinhq/xezilaires-dev","last_synced_at":"2025-04-07T10:19:27.901Z","repository":{"id":42430599,"uuid":"141314530","full_name":"sigwinhq/xezilaires-dev","owner":"sigwinhq","description":"Iterate structured Excel spreadsheets, normalize rows into value objects, validate, serialize into CSV, JSON, XML.","archived":false,"fork":false,"pushed_at":"2025-02-14T10:54:11.000Z","size":501,"stargazers_count":62,"open_issues_count":29,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T09:03:22.846Z","etag":null,"topics":["csv-export","hacktoberfest","iterator","json-export","normalization","php","php-tools","serializable-objects","serialization","spreadsheet","spreadsheet-data","spreadsheet-mapper","spreadsheets","validation","xml-export"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigwinhq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-17T16:16:22.000Z","updated_at":"2025-02-10T16:47:32.000Z","dependencies_parsed_at":"2024-06-24T16:38:09.215Z","dependency_job_id":null,"html_url":"https://github.com/sigwinhq/xezilaires-dev","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigwinhq%2Fxezilaires-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigwinhq%2Fxezilaires-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigwinhq%2Fxezilaires-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigwinhq%2Fxezilaires-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigwinhq","download_url":"https://codeload.github.com/sigwinhq/xezilaires-dev/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247631834,"owners_count":20970069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv-export","hacktoberfest","iterator","json-export","normalization","php","php-tools","serializable-objects","serialization","spreadsheet","spreadsheet-data","spreadsheet-mapper","spreadsheets","validation","xml-export"],"created_at":"2024-11-06T12:26:39.833Z","updated_at":"2025-04-07T10:19:27.874Z","avatar_url":"https://github.com/sigwinhq.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xezilaires\n\nXezilaires is a PHP library which helps to iterate structured Excel spreadsheets,\nnormalize rows into value objects, validate, serialize into CSV, JSON, XML.\n\n[![Latest Stable Version](https://poser.pugx.org/sigwin/xezilaires/v/stable.png)](https://github.com/sigwinhq/xezilaires-dev)\n[![Actions Status](https://github.com/sigwinhq/xezilaires-dev/workflows/Build/badge.svg)](https://github.com/sigwinhq/xezilaires-dev/actions)\n[![PHPStan enabled](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)\n[![Psalm enabled](https://img.shields.io/badge/Psalm-enabled-brightgreen.svg?style=flat)](https://github.com/vimeo/psalm)\n\n## What it does\n\n1. we create a PHP class which will hold our Excel row data\n2. we next create spreadsheet iterator instance\n    1. passing the path to the Excel file we wish to read\n    2. passing the configuration mapping the Excel columns into PHP properties\n3. as we're iterating, we are getting an value object (instance of the defined class)\n   for each row\n\nThink of it as an \"ORM\" *(Object Relation Manager)* for an Excel file.\nAn OEM *(Object Excel Manager)*, if you will.\n\n## Example usage\n\n### Without attributes\n\n```php\nclass Product\n{\n    private $name;\n}\n\n$symfonySerializer = new \\Symfony\\Component\\Serializer\\Serializer([\n    new \\Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer(),\n]);\n$normalizer = new \\Xezilaires\\Bridge\\Symfony\\Serializer\\ObjectSerializer($symfonySerializer);\n$iteratorFactory = new \\Xezilaires\\SpreadsheetIteratorFactory($normalizer, [\n    \\Xezilaires\\Bridge\\PhpSpreadsheet\\Spreadsheet::class,\n]);\n\n$iterator = $iteratorFactory-\u003efromFile(\n    // https://github.com/sigwinhq/xezilaires-dev/raw/master/src/Xezilaires/Test/resources/fixtures/products.xlsx\n    new \\SplFileObject(__DIR__.'/../../src/Xezilaires/Test/resources/fixtures/products.xlsx'),\n    new \\Xezilaires\\Metadata\\Mapping(\n        Model\\Product::class,\n        [\n            'name' =\u003e new \\Xezilaires\\Metadata\\ColumnReference('A'),\n        ],\n        [\n            // options\n            'start' =\u003e 2,\n        ]\n    )\n);\n```\n\n### With attributes\n\n```php\nuse Xezilaires\\Attribute as XLS;\n\n\n#[XLS\\Options(header=1, start=2)]\nclass Product\n{\n    #[@XLS\\HeaderReference(header=\"Name\")]\n    private $name;\n}\n\n$symfonySerializer = new \\Symfony\\Component\\Serializer\\Serializer([\n    new \\Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer(),\n]);\n$normalizer = new \\Xezilaires\\Bridge\\Symfony\\Serializer\\ObjectSerializer($symfonySerializer);\n$iteratorFactory = new \\Xezilaires\\SpreadsheetIteratorFactory($normalizer, [\n    \\Xezilaires\\Bridge\\PhpSpreadsheet\\Spreadsheet::class,\n]);\n$attributeDriver = new \\Xezilaires\\Metadata\\Attribute\\AttributeDriver();\n\n$iterator = $iteratorFactory-\u003efromFile(\n    // https://github.com/sigwinhq/xezilaires-dev/raw/master/src/Xezilaires/Test/resources/fixtures/products.xlsx\n    new \\SplFileObject(__DIR__.'/../../src/Xezilaires/Test/resources/fixtures/products.xlsx'),\n    $attributeDriver-\u003egetMetadataMapping(Product::class, ['reverse' =\u003e true])\n);\n```\n\nSee more examples in the [`docs/examples/`](./docs/examples/) folder.\n\n## Options\n\n- `start`, which row do we start on  \n  *(integer, optional, default: `1`)*\n- `header`, which row contains the header labels  \n  *(integer, optional if not using `HeaderReference`, default: `null`)*\n- `reverse`, do we iterate the rows in reverse, from end to start  \n  *(boolean, optional, default: `false`)*\n- `sequential`, is the key sequential (0, 1, 2) or represents current row?  \n  *(boolean, optional, default: `false`)*\n\n## Features\n\nFeatures included:\n\n- **Reading Excel files**  \n*(using either `phpoffice/PhpSpreadsheet` or `openspout/openspout`)*\n- **Denormalization / normalization** support  \n*(using `symfony/serializer`, from / to all supported formats)*\n- Attributes support\n- mapping via **column names** or **header labels**  \n*(saying \"Map header label `PrdctEN` to property `product`\")*\n- **A Symfony bundle**  \n*(for easy integration into existing apps)*\n- CLI *(command-line interface)* tool\n\n## Custom normalizers / validators\n\nYou can use your own normalizers / validators by passing your own Symfony bundle\nwhich registers them to the Xezilaires commands via `--bundle`, like so: \n\n```\nvendor/bin/xezilaires validate --bundle Xezilaires\\\\Test\\\\ExampleBundle\\\\XezilairesExampleBundle Xezilaires\\\\Test\\\\Model\\\\Product src/Xezilaires/Test/resources/fixtures/products.xlsx \n```\n\nSee example bundle in [`src/Xezilaires/Test/ExampleBundle/`](./src/Xezilaires/Test/ExampleBundle/).\n\n## What's with the name\n\n`xezilaires` is `serializex` backwards.\n\nWe added the X so the name so we can shorten it as [XLS](https://fileinfo.com/extension/xls).\nAs a side-effect, we [made reading Excel files with this library cool](https://tvtropes.org/pmwiki/pmwiki.php/Main/XMakesAnythingCool).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigwinhq%2Fxezilaires-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigwinhq%2Fxezilaires-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigwinhq%2Fxezilaires-dev/lists"}