# Tsukuru

> Lightweight PHP templating library for data transformation into CSV, XML, JSON, YAML, and more

Tsukuru (Japanese for "to create") is a PHP templating library designed specifically for data transformation. Unlike HTML templating engines like Twig or Blade, Tsukuru is built to convert structured data into any text-based output format — CSV exports, XML feeds, JSON APIs, YAML configs, and more.

Under the hood, it uses a clean three-stage compiler pipeline: Lexer → Parser → Compiler. This architecture ensures predictable output, excellent error messages, and easy extensibility.

**Website:** [tsukuru.dev](https://tsukuru.dev)

## Installation

```bash
composer require qoliber/tsukuru
```

**Requires:** PHP 8.1+ — zero external dependencies.

## Supported Output Formats

CSV, XML, JSON, YAML, TOML, HTML, Markdown, INI, XSD — or any custom text format you define.

## Key Features

- **Format-agnostic** — One library for all your data export needs instead of separate CSV writers, XML builders, etc.
- **Control flow** — Loops, conditionals, and pattern matching for complex data transformations
- **Smart object handling** — Automatic getter detection, property access for arrays and objects, nested path resolution
- **Custom functions** — Register domain-specific functions (price formatting, SKU generation, tax calculations)
- **Security built-in** — HTML, XML, CSV, URL, and JSON escaping functions prevent injection vulnerabilities
- **Well-tested** — 196 tests, 423 assertions, 88% mutation score

## Ideal For

- **E-commerce exports** — Product feeds, order exports, inventory reports
- **XML feed generation** — Google Shopping, marketplace integrations, ERP connectors
- **API response formatting** — Consistent serialization across endpoints
- **Configuration generation** — Environment-specific configs, deployment manifests
- **Report generation** — Scheduled data reports in any format

## License

MIT License
