dallgoot/yaml 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dallgoot/yaml

Composer 安装命令:

composer require dallgoot/yaml

包简介

Provides loader, dumper and an API for YAML content. Loader builds to equivalent data types in PHP 8.x

README 文档

README

Build Status PHP from Packagist Packagist Maintainability Scrutinizer Code Quality Code Coverage

PHP library to load and parse YAML file to coherent PHP datatypes equivalent

Dallgoot/Yaml Library

Installation

  • Dependencies are only useful for building documentation or for code contribution, so the "--update-no-dev" prevent from downloading and managing packages that you probably won't use.

You first need Composer and PHP ^8.1.14

composer require --update-no-dev dallgoot/yaml

Usage

See examples folder

Features

  • consistent PHP datatypes :
    • object for mappings
    • array for sequences
    • common scalars : string, integer, float, INF, NAN
    • JSON, DateTime(option), etc.
  • specific types (objects)
    • YamlObject for each Yaml content (multi-documents YAML is an array of YamlObject)
    • Compact for compact/short YAML syntax
    • Tagged object when tag is not determinable
  • recover from some parsing errors
  • tolerant to tabulations
  • debug levels :
    • 1 : print each line Node Type class and exit
    • 2 : print Loader global tree structure and exit
    • 3 : print each document NodeList and exit

Support

  • YAML specifications version 1.2
  • multi-line values (simple|double quoted or not, compact mapping|sequence or JSON)
  • multiple documents in a content (file or string)
  • compact syntax for mappings and sequences
  • comments (not yet implemented)
  • references (option : enabled by default)
  • tags with behaviour customization (overriding for common(CoreSchema), or specifying for custom) via implementing Tag/SchemaInterface.

What's different from other PHP Yaml libraries ?

YAML version supported coherent data types multiple documents JSON format validation complex mapping real reference behaviour custom tags handling
Symfony Yaml 1.2 ✔️
php-yaml 1.1 ✔️ ✔️
syck 1.0
spyc 1.0
Dallgoot/Yaml 1.2 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
  • coherent data types (see coherence.md for explanations)
  • JSON format validation (Option, Note: if valid as per PHP function json_encode)
  • complex mapping (Note: keys are JSON formatted strings)
  • real reference behaviour : changing reference value modify other reference calls

Contributing

Only contributions concerning bug fixes will be review ATM. Requests for features will be dealt with after reading/writing YAML is considered bug free (and al current Options are implemented)

ToDo

  • Code coverage : target 100%
  • Benchmarks against other libs

Improvements

  • Examples of each function of the API
  • implement specific unit test for each YAML spec. invalid cases (what must not happen)
  • DUMPER:
    • implement/verify Dumper::Options
  • better/more precise errors identification (Yaml validation) with explanation in YAML content
  • Unicode checking (???)
  • OPTION : parse dates as PHP DateTime object
  • OPTION: Force renaming key names that are not valid PHP property name
  • TAG : function for 'php/object' that provides the correct namespace to build
  • NEON compatibility???
  • make immutable YamlObject

Performances

- TBD
- improved memory using SplFixedArray instead of regular arrays where possible

Sponsor

That is greatly appreciated : Buy Me A Coffee

Thanks

dallgoot/yaml 适用场景与选型建议

dallgoot/yaml 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 256.05k 次下载、GitHub Stars 达 42, 最近一次更新时间为 2019 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「yaml」 「parser」 「writer」 「reader」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dallgoot/yaml 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dallgoot/yaml 我们能提供哪些服务?
定制开发 / 二次开发

基于 dallgoot/yaml 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 256.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 43
  • 点击次数: 32
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 42
  • Watchers: 4
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-09-30