haydenwu/kdl
Composer 安装命令:
composer require haydenwu/kdl
包简介
A PHP implementation for the KDL data format (forked)
README 文档
README
KDL-PHP
A PHP library for the KDL Document Language (pronounced like "cuddle").
This is my fork of the official implementation in PHP, which hasn't been maintained for a while now. I'm partially implementing features of KDL v2 where I need; it may or may not parse your KDL v2 document fully and properly.
Installation
The KDL library can be included to your project using Composer:
composer require haydenwu/kdl:dev-2_0_support
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 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
$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
The code is available under the MIT license.
haydenwu/kdl 适用场景与选型建议
haydenwu/kdl 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 haydenwu/kdl 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 haydenwu/kdl 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-01