PHPackages                             xp-forge/yaml - 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. xp-forge/yaml

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

xp-forge/yaml
=============

YAML parser

v9.0.0(1y ago)035.3k↑16.7%1[1 issues](https://github.com/xp-forge/yaml/issues)1BSD-3-ClausePHPPHP &gt;=7.4.0CI passing

Since Jan 10Pushed 1y ago2 watchersCompare

[ Source](https://github.com/xp-forge/yaml)[ Packagist](https://packagist.org/packages/xp-forge/yaml)[ Docs](http://xp-framework.net/)[ RSS](/packages/xp-forge-yaml/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (27)Used By (1)

YAML parser
===========

[](#yaml-parser)

[![Build status on GitHub](https://github.com/xp-forge/yaml/workflows/Tests/badge.svg)](https://github.com/xp-forge/yaml/actions)[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/c040012dbe073b8b7e12e92d88dba23a9a1b49a828f688ab1e67d0c766109d44/68747470733a2f2f706f7365722e707567782e6f72672f78702d666f7267652f79616d6c2f76657273696f6e2e737667)](https://packagist.org/packages/xp-forge/yaml)

- See
- See
- See

Usage example
-------------

[](#usage-example)

```
use org\yaml\{YamlParser, FileInput};

$result= (new YamlParser())->parse(new FileInput('.travis.yml'));
// [
//   language => "php"
//   php => [7, 7.1, 7.2, 7.3, 7.4, "nightly"]
//   matrix => [
//     allow_failures => [[
//       php => "nightly"
//     ]]
//   ]
//   before_script => ["curl ...", ...]
//   script => ["sh xp-run xp.unittest.TestRunner src/test/php"]
// ]
```

Inputs
------

[](#inputs)

- `org.yaml.FileInput(io.File|string $in)` - Use file instance or a file name
- `org.yaml.ReaderInput(io.streams.TextReader $in)` - Reads from a text reader
- `org.yaml.StringInput(string $in)` - Input from a string

Multiple documents
------------------

[](#multiple-documents)

YAML sources can contain more than one document. The `parse()` method will only parse the first (or only) document. To retrieve all documents in a given input, use the iterator returned by `documents()` instead.

```
use org\yaml\{YamlParser, FileInput};
use util\cmd\Console;

$parser= new YamlParser();
foreach ($parser->documents(new FileInput('objects.yml')) as $i => $document) {
  Console::writeLine('Document #', $i, ': ', $document);
}
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance49

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 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 ~157 days

Recently: every ~233 days

Total

25

Last Release

374d ago

Major Versions

v4.0.0 → v5.0.02018-06-02

v5.2.2 → v6.0.02020-04-10

v6.0.3 → v7.0.02022-10-18

v7.1.0 → v8.0.02024-02-04

v8.1.0 → v9.0.02025-05-10

PHP version history (5 changes)v1.0.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=5.5.0

v4.0.0PHP &gt;=5.6.0

v6.0.0PHP &gt;=7.0.0

v9.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07d18d882c8b4aaf3466432f64018214f2771eda333202175431ee7233795376?d=identicon)[thekid](/maintainers/thekid)

---

Top Contributors

[![thekid](https://avatars.githubusercontent.com/u/696742?v=4)](https://github.com/thekid "thekid (239 commits)")

---

Tags

parserxp-frameworkyamlmodulexp

### Embed Badge

![Health badge](/badges/xp-forge-yaml/health.svg)

```
[![Health](https://phpackages.com/badges/xp-forge-yaml/health.svg)](https://phpackages.com/packages/xp-forge-yaml)
```

PHPackages © 2026

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