From: Makoto K. <kw...@ku...> - 2008-04-26 09:32:53
|
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 |
From: Alexey Z. <ind...@gm...> - 2008-04-27 08:11:43
|
On 4/26/08, Makoto Kuwata <kw...@ku...> wrote: > 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. "next generation PHP" sounds a bit loud. (offtopic on this list, anyway) but regarding libyaml binding: that's interesting! I looked thru the sources — looks, like there are some rough edges. will try to run it thru some tests. what is the status of this extension? is it still developed? is there some subversion/cvs/git/whatever repository available for it? why wasn't it submitted to pecl? > > 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 > _______________________________________________ > Yaml-core mailing list > Yam...@li... > https://lists.sourceforge.net/lists/listinfo/yaml-core > -- Alexey Zakhlestin http://blog.milkfarmsoft.com/ |
From: <kw...@ku...> - 2008-04-27 11:06:24
|
Hi Alexey, On 4/27/08, Alexey Zakhlestin <ind...@gm...> wrote: > but regarding libyaml binding: that's interesting! > I looked thru the sources — looks, like there are some rough edges. > will try to run it thru some tests. > > what is the status of this extension? > is it still developed? is there some subversion/cvs/git/whatever > repository available for it? why wasn't it submitted to pecl? > I don't know about them because I'm not an author. I have tried to contact with the author, but no reply. -- regards, makoto kuwata |
From: Alexey Z. <ind...@gm...> - 2008-04-27 13:17:31
|
On Sun, Apr 27, 2008 at 3:06 PM, <kw...@ku...> wrote: > On 4/27/08, Alexey Zakhlestin <ind...@gm...> wrote: > > but regarding libyaml binding: that's interesting! > > I looked thru the sources — looks, like there are some rough edges. > > will try to run it thru some tests. > > > > what is the status of this extension? > > is it still developed? is there some subversion/cvs/git/whatever > > repository available for it? why wasn't it submitted to pecl? > > > > I don't know about them because I'm not an author. > I have tried to contact with the author, but no reply. ok. I hope he will appear. while the basis is settled, there is still a lot to do on this extension I really like the approach with custom handlers for 'tags'. I was going to implement similiar concept in syck-binding. But default behavior of yaml extension is bad, because it won't be able to export document identical to the one it parsed. -- Alexey Zakhlestin http://blog.milkfarmsoft.com/ |