PHP YAML 解析器 [英] PHP YAML Parsers

查看:32
本文介绍了PHP YAML 解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道一个好的 PHP YAML 解析器?如果是这样,这个库的优缺点是什么?

Does anyone know of a good YAML Parser for PHP? If so, what are the pros and cons of this library?

推荐答案

上次更新:2017 年 7 月 26 日

Last updated: July 26th, 2017

以下是 PHP 中 YAML 状态的总结:

Here's a summary of the state of YAML in PHP:

  • C 库的包装器:如果您需要绝对的速度,您可能需要这些:
    • Wrappers to C libraries: You'll probably want these if you need sheer speed:
      • php-yaml: Wrapper for LibYAML. Available as a PECL extension; it is also the one on PHP's docs.
      • syck: Binding to syck; also available as a PECL extension. (dated, see below)

      纯 PHP 实现:

      • sfYaml:Symfony 的 YAML 组件.您可以在此处查看其作者的动机.他想要一些易于使用、快速、经过单元测试并且有明确的错误消息."
      • spyc:无依赖的 YAML 解析器
      • sfYaml: Symfony's YAML component. You can see its authors' motivations here. He wanted something that was "easy to use, fast, unit tested and had clear error messages."
      • spyc: YAML parser without dependencies

      在撰写本文时,上述库的最新版本发布日期和 YAML 规范的版本(1.2 是最新版本)他们支持的是:

      At the time of this writing, the latest versions release dates for the aforementioned libraries and the versions of the YAML spec (1.2 is the latest version) they support are:

      php-yaml   1.3.0     2016-09-24     YAML 1.1  [PHP 5]
      php-yaml   2.0.0     2016-09-24     YAML 1.1  [PHP 7]
      syck       0.9.3     2008-11-18     YAML 1.0
      sfYaml     3.3.5     2017-06-15     YAML 1.1, most of 1.2
      spyc       0.6.2     2017-02-24     YAML 1.1 
      

      这篇关于PHP YAML 解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆