PHP YAML解析器 [英] PHP YAML Parsers

查看:87
本文介绍了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天全站免登陆