PHPackages                             opencat/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. [Localization &amp; i18n](/categories/localization)
4. /
5. opencat/xliff

ActiveLibrary[Localization &amp; i18n](/categories/localization)

opencat/xliff
=============

XLIFF 1.2 writer and reader for the OpenCAT Framework

10PHP

Since May 9Pushed 2mo agoCompare

[ Source](https://github.com/shaikhammar/opencat-xliff)[ Packagist](https://packagist.org/packages/opencat/xliff)[ RSS](/packages/opencat-xliff/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

opencat/xliff
=============

[](#opencatxliff)

XLIFF 1.2 writer and reader for the [OpenCAT Framework](https://github.com/shaikhammar/opencat-framework).

Serialises a `BilingualDocument` to XLIFF 1.2 (plus a companion `.skl` skeleton file) and reads it back. XLIFF is the interchange format between the extraction/segmentation phase and the translation phase — it can be sent to a translator or a TMS and then read back to rebuild the translated file.

Installation
------------

[](#installation)

```
composer require opencat/xliff
```

Requires `ext-dom` and `ext-libxml`.

Writing XLIFF
-------------

[](#writing-xliff)

```
use CatFramework\Xliff\XliffWriter;

$writer = new XliffWriter();
$writer->write($doc, 'project.xlf');
// Also writes project.xlf.skl (JSON skeleton — required for rebuild)
```

Reading XLIFF
-------------

[](#reading-xliff)

```
use CatFramework\Xliff\XliffReader;

$reader = new XliffReader();
$doc = $reader->read('project.xlf');
// Loads the .skl file automatically (expects project.xlf.skl alongside)

// Rebuild the original file format
$filter->rebuild($doc, 'translated-output.docx');
```

XLIFF output format
-------------------

[](#xliff-output-format)

```

        Hello &lt;strong&gt;world&lt;/strong&gt;!
        Bonjour &lt;strong&gt;monde&lt;/strong&gt;!

```

Inline code mapping
-------------------

[](#inline-code-mapping)

`InlineCode` objects are serialised as XLIFF inline elements:

`InlineCode``isIsolated`XLIFF element`OPENING`false```CLOSING`false```STANDALONE`false```OPENING`true```CLOSING`true``The `catfw:equiv-text` attribute carries `InlineCode::$displayText` when set, giving CAT tools a human-readable hint (e.g. `` instead of the raw `` tag).

Segment status mapping
----------------------

[](#segment-status-mapping)

`SegmentStatus`XLIFF `state``Untranslated``new``Draft``new``Translated``translated``Reviewed``signed-off``Approved``final``Rejected``needs-translation`Locked segments (`SegmentPair::$isLocked = true`) are written with `translate="no"`.

Skeleton file
-------------

[](#skeleton-file)

The `.skl` file is a JSON-encoded copy of `BilingualDocument::$skeleton` — the filter-specific data needed to rebuild the original file. It is written alongside the XLIFF and must remain with it. The reader looks for `{xliffPath}.skl` automatically.

Related packages
----------------

[](#related-packages)

- [`opencat/core`](https://github.com/shaikhammar/opencat-framework/tree/main/packages/core) — `BilingualDocument`, `SegmentPair`, `Segment`, `InlineCode`
- [`opencat/workflow`](https://github.com/shaikhammar/opencat-framework/tree/main/packages/workflow) — calls `XliffWriter` as the final step in the processing pipeline

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance56

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (4 commits)")

### Embed Badge

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

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

PHPackages © 2026

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