PHP binding for LibYAML

"Makoto Kuwata" <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Hi all,
I found the PHP binding for LibYAML.
php_yaml - http://www.opendogs.org/pub/php_yaml-0.3.0.tgz

The author rsky is known for QIQ, a next generation PHP.


Usage:
------------------
<?php
/// load yaml.so
if (! extension_loaded('yaml')) {
    dl('yaml.so') or die('cannot load yaml.so.');
}
/// configure to parse date and timestamp
if (function_exists('date_create')) {
  ini_set('yaml.decode_timestamp', 2);  // use DateTime
} else {
  ini_set('yaml.decode_timestamp', 1);  // use seconds (integer)
}
/// read YAML document
$str = file_get_contents("example.yaml");
$ydoc = yaml_parse($str);
/// or
//$ydoc = yaml_parse_file("example.yaml");
var_dump($ydoc);
?>
------------------


I found some problems in php_yaml.
(a) Currently it only supports loading YAML.
    It means that dumping is not available.
(b) Merge ('<<') is not supported.
(c) Default value ('=') is not supported.
(d) Scalar value can be empty string instead of NULL
    when no data specified.
(e) It can't parse '2008-01-01 12:34:56'.


I create a patch to fixe (d) and (e).
http://www.kuwata-lab.com/materials/php_yaml-0.3.0.patch


If you want to get YAML1.1 parser in PHP, try php_yaml.

--
regards,
makoto kuwata

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.