PHPackages                             kdl/kdl - 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. kdl/kdl

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

kdl/kdl
=======

A PHP implementation for the KDL data format

0.4.0(4y ago)1949↓90%4[2 PRs](https://github.com/kdl-org/kdl-php/pulls)MITPHPPHP &gt;=7.4

Since Jan 8Pushed 1y ago2 watchersCompare

[ Source](https://github.com/kdl-org/kdl-php)[ Packagist](https://packagist.org/packages/kdl/kdl)[ RSS](/packages/kdl-kdl/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)Dependencies (5)Versions (7)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/51cf0ccf711466604a2784f5a917453261e53c59dc26ec6b370c79e1c555924b/68747470733a2f2f706f7365722e707567782e6f72672f6b646c2f6b646c2f76)](//packagist.org/packages/kdl/kdl) [![License](https://camo.githubusercontent.com/f607730ec206ca14e18a5356c7f5115dd45ee60af8ff0ae55f58115297176d6d/68747470733a2f2f706f7365722e707567782e6f72672f6b646c2f6b646c2f6c6963656e7365)](//packagist.org/packages/kdl/kdl) [![Status](https://github.com/kdl-org/kdl-php/workflows/Project%20checks/badge.svg?branch=main)](https://github.com/kdl-org/kdl-php/workflows/Project%20checks/badge.svg?branch=main)

KDL-PHP
=======

[](#kdl-php)

A PHP library for the [KDL Document Language](https://kdl.dev) (pronounced like "cuddle").

[![alt text](./kdl.svg "KDL logo")](./kdl.svg)

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

[](#installation)

The KDL library can be included to your project using Composer:

`composer require kdl/kdl`

Limitations
-----------

[](#limitations)

For now, this library only supports parsing.

Parsing a 45 line file with a tree depth of 5 is likely to take about 30ms currently - this speed is improving all the time with releases of the underlying parser library. This library favours correctness over performance - however, the aim is for parse speed to improve to a point of being reasonable.

The parser uses [Parsica](https://parsica.verraes.net/) as an underlying parsing library in order to map fairly directly and clearly onto the published KDL grammar - Parsica uses FP principles, and one result of this is that the call stack depth used during parsing may be high. Be warned if you are using e.g. xdebug, as parsing may exceed any normal maximum stack depth that you may set.

Examples
--------

[](#examples)

```
$document = Kdl\Kdl\Kdl::parse($kdlString);
foreach ($document as $node) {
    $node->getName(); //gets the name for the node @see https://github.com/kdl-org/kdl/blob/main/SPEC.md#node
    $node->getValues(); //gets a list of values for a node @see https://github.com/kdl-org/kdl/blob/main/SPEC.md#value
    $node->getProperties(); //gets an associative array of properties @see https://github.com/kdl-org/kdl/blob/main/SPEC.md#property
    foreach ($node->getChildren() as $child) {
        $child->getName(); //name for the child
       //etc
    }
}
```

License
-------

[](#license)

The code is available under the [MIT license](LICENSE).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

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

Total

5

Last Release

1814d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/67cf8ed88be79605642722cbc5902206c2e51adf755f70cfff04b2c7e5abc9ce?d=identicon)[shieldo](/maintainers/shieldo)

---

Top Contributors

[![shieldo](https://avatars.githubusercontent.com/u/97280?v=4)](https://github.com/shieldo "shieldo (29 commits)")

---

Tags

kdlparser

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

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

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

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

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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