2009-06-11

FluentDOM

Today I like to present a new projekt: FluentDOM

It provides an easy to use, jQuery like, fluent interface for DOMDocument.

The idea was born in a workshop of Tobias Schlitt about the PHP XML extensions at the IPC Spring in Berlin.

The last few days Bastian Feder and I implemented it. That's how it looks in action:

require_once('../FluentDOM.php');
echo FluentDOM($xml)
 ->node(
   FluentDOM($samples)
   ->find('//b[@id = "first"]')
   ->removeAttr('id')
   ->addClass('imported')
 )
 ->replaceAll('//p');

We are aware that here are some other projects with similiar concepts. But none of them matched our requirements (XML targeted, XPath selectors, namespace support, ...).

You can take a look at the current version in Bastian's public SVN.

svn://fluentdom.org/trunk/FluentDOM