PHPackages                             vivomedia/xliff - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. vivomedia/xliff

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

vivomedia/xliff
===============

Simple Xliff-File reader and writer

1.0.2(2y ago)0578[1 issues](https://github.com/VIVOMEDIA/xliff/issues)MITPHPPHP ^8.0

Since Jan 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/VIVOMEDIA/xliff)[ Packagist](https://packagist.org/packages/vivomedia/xliff)[ RSS](/packages/vivomedia-xliff/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/bf33b375e321f6a425d46c17475ee9440d6b2976c24992aee7222afd290b6712/68747470733a2f2f706f7365722e707567782e6f72672f7669766f6d656469612f786c6966662f762f737461626c65)](https://packagist.org/packages/vivomedia/xliff)[![Total Downloads](https://camo.githubusercontent.com/5e4ce7264a1e80362d7ac6e708b96e312f62126a6ee63d9d452f0ba1750b4a58/68747470733a2f2f706f7365722e707567782e6f72672f7669766f6d656469612f786c6966662f646f776e6c6f616473)](https://packagist.org/packages/vivomedia/xliff)[![License](https://camo.githubusercontent.com/5c103c6654004d4a4a0adbd334b67a617a7aa4e467d1662285c17c1c0a6dbbb1/68747470733a2f2f706f7365722e707567782e6f72672f7669766f6d656469612f786c6966662f6c6963656e7365)](https://packagist.org/packages/vivomedia/xliff)

VIVOMEDIA Xliff Reader and Writer
=================================

[](#vivomedia-xliff-reader-and-writer)

Simple Xliff Reader and Writer. Currently only Xliff Version 1.2.

Install
-------

[](#install)

```
composer require vivomedia/xliff

```

How to use
----------

[](#how-to-use)

### Reader

[](#reader)

```
use VIVOMEDIA\XliffParser\Domain\V12\TransUnit;
use VIVOMEDIA\XliffParser\Reader\V12\XliffReader;

$reader = new XliffReader();
$document = $reader->read('/path/to/file.xlf');

foreach ($read->getFiles() as $file) {
    foreach ($file->getBodyItems() as $bodyItem) {
        if ($bodyItem instanceof TransUnit) {
            printf(
                "'%s' | '%s' => '%s'\n",
                $bodyItem->getAttributes()->get('id'),
                $bodyItem->getSource()->getContent(),
                $bodyItem->getTarget()?->getContent(),
            );
        }
    }
}
```

### Writer

[](#writer)

```
use VIVOMEDIA\XliffParser\Domain\V12\Attributes;
use VIVOMEDIA\XliffParser\Domain\V12\Document;
use VIVOMEDIA\XliffParser\Domain\V12\File;
use VIVOMEDIA\XliffParser\Domain\V12\Source;use VIVOMEDIA\XliffParser\Domain\V12\Target;use VIVOMEDIA\XliffParser\Domain\V12\TransUnit;
use VIVOMEDIA\XliffParser\Writer\V12\XliffWriter;

$b = new XliffWriter();
$b->write($read, $pathES);

$sourceAttributes = new Attributes(["xml" => ['lang' => "de"]]);
$source = new Source("Bitte übersetzen", $sourceAttributes);

$targetAttributes = new Attributes([null => ['state' => 'translated'], "xml" => ['lang' => "en"]]);
$target = new Target("Please translate", $targetAttributes);

$transUnitAttributes = new Attributes([null => ['id' => "my.identifier", "approved" => "yes"]]);
$transUnitItem = new TransUnit($source, $target, $transUnitAttributes);

$fileAttributes = new Attributes([null => ['product-name' => "MyProduct", "source-language" => "de", "target-language" => "en"]]);
$file = new File([$transUnitItem], $fileAttributes);

$document = new Document([$file]);

$writer = new XliffWriter();
$writer->write($document, '/path/to/other.xlf');
```

Result

```

                Bitte übersetzen
                Please translate

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

833d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a003ae6bea3612ba71a5d5e34478807946dc4a073893c6e7897648095bf4440d?d=identicon)[dlubitz](/maintainers/dlubitz)

---

Top Contributors

[![dlubitz](https://avatars.githubusercontent.com/u/13046100?v=4)](https://github.com/dlubitz "dlubitz (5 commits)")

---

Tags

neosneoscms

### Embed Badge

![Health badge](/badges/vivomedia-xliff/health.svg)

```
[![Health](https://phpackages.com/badges/vivomedia-xliff/health.svg)](https://phpackages.com/packages/vivomedia-xliff)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M283](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M63](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M344](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
