Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:869 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63707 invoked from network); 11 Apr 2003 17:58:09 -0000 Received: from unknown (HELO rysa.inetz.com) (209.63.19.145) by pb1.pair.com with SMTP; 11 Apr 2003 17:58:09 -0000 Received: (qmail 43312 invoked by uid 10112); 11 Apr 2003 18:09:47 -0000 Date: Fri, 11 Apr 2003 12:09:47 -0600 To: internals@lists.php.net Message-ID: <20030411180947.GA43294@rysa.inetz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Uptime: 12:08PM up 3 days, 21:02, 1 user, load averages: 0.25, 0.08, 0.03 X-Sealab-2021: "Well it's in the red now, sir. *snigger* It's in the red.. I'm from Accounting.." - Ted from Accounting User-Agent: Mutt/1.5.1i Subject: RFC: YAML Support for PHP (Syck) From: php-internals@whytheluckystiff.net (why the lucky stiff) Hi. I'm a long-time PHP developer and author of YAML for Ruby. The last few months I've been sick of not having a YAML extension for PHP, so I started working on a YAML extension that could be leveraged by scripting languages which provide a C API to access the symbol table. The extension is Syck. I have released 0.15 today. I've made great progress in the last month or two and am ready to start stabilizing this sucker and get some user input. Right now I simply provide a syck_load() function which takes a YAML string and builds native PHP structures. YAML has had good success in the Ruby, Perl and Python worlds. The extension has been given a spot in forthcoming releases of Ruby. Much discussion has occurred on the Yaml-Core list concerning how to best approach PHP data structures. It will be good to see this work pay off a working extension. Please come join the list if you are interested. We could absolutely use the input. Release notes in YAML below. Thank you. --- released: { name: Syck, version: 0.15 } for: [ Ruby, PHP, Python ] by: why the lucky stiff about: > Syck is a YAML parser, an extension for scripting languages, written in C. So what is YAML? YAML is a new language for data. Describe objects in plain text. Load the data into your scripting language as arrays, dictionaries, classes, or primitives. links: YAML: http://www.yaml.org/ YAML Cookbook: http://yaml4r.sf.net/cookbook/ YAML Type Repository: http://yaml.org/type/ YAML Specification: http://yaml.org/spec/ Syck: http://www.whytheluckystiff.net/syck/ Syck Benchmarks: http://www.whytheluckystiff.net/arch/2003/03/19 Tarball @ SourceForge: http://aleron.dl.sourceforge.net/sourceforge/yaml4r/syck-0.15.tar.gz status: > Syck is about 60% compliant with the YAML spec. Most of the remaining issues deal with whitespace. Syck also doesn't yet support any of the shortcut syntax optimizations from the specification. The extensions are quite usable, though. Ruby, PHP and Python can load from a string containing YAML. Ruby also has support for stream loading from any IO object. benchmarks: > Syck is quite speedy, although not as swift as most language's native serialization. Syck runs at about: 30-35% of the speed of Ruby's Marshal. 15-50% of the speed of PHP's deserialize(). 600% of the speed of Python's Pickle. 33-40% of the speed of Python's cPickle. (Based on various types of structured data.) installation: > Syck contains working extensions for the Ruby, PHP, and Python languages. Each requires compilation of the libsyck library, followed by compilation of the extension. To compile libsyck, first download libsyck. tar xzvf syck-0.15.tar.gz cd syck-0.15 ./configure make sudo make install To install the Ruby extension: cd ext/ruby/ext ruby extconf.rb make sudo make install To install the Python extension: cd ext/python python setup.py build sudo python setup.py install To install the PHP extension: sh make_module.sh sudo make install (if you weren't root during make_module.sh) php -q syck.php examples: | To load this document in Ruby: ($:~)$ irb >> require 'syck' => true >> yp = YAML::Syck::Parser.new( {} ) => # >> yp.load( File.open( 'syck-0.15.yml' ) ) => {"status"=>"Syck is about 60% compliant ..."} To load this document in PHP: ($:~)$ php -a Interactive mode enabled .. php then outputs .. X-Powered-By: PHP/4.2.3 Content-type: text/html Array ( [released] => Array ( [name] => Syck [version] => 0.15 ) .. and so on .. To load this document in Python: ($:~)$ python Python 2.1.3 (#1, Jul 11 2002, 17:52:24) [GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4 Type "copyright", "credits" or "license" for more information. >>> import syck >>> f = open( 'syck-0.15.yml' ) >>> syck.load( f.read() ) {'by': 'why the lucky stiff', ... }