I’ve previously written an extension of PHP’s DOMDocument library, which I’ve used for many, many different projects. I’ve been looking at Symfony and Laravel recently and it appears that whilst they do offer a DOMCrawler for working with DOM, both frameworks are a little bit lacking in functionality for manipulating DOM.

I’ve found various PHP projects which implement jQuery like behaviour for PHP, however these either don’t follow normal programming conventions or appear to be no longer maintained.

This weekend I’ll be putting together a new DOMDocument library. This library will recycle some functions from Smart\Document however there will be a few significant differences:

  • HTML5 support via Masterminds/html5-php, where DOMDocument only supports HTML4
  • CSS selector translation to XPath using Symfony’s conversion module, rather than using my own parser and translator
  • Support for as many jQuery methods as possible, using the same names
  • Full support for method chaining, not just on elements, but on result sets

I’ll also be adding unit testing to this particular project, and I’ll be creating the project as a library which can be installed via Composer.

Leave a Reply