2017 © Pedro Peláez
 

library better-dom-document

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

image

highwire/better-dom-document

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  • Friday, September 29, 2017
  • by phayes
  • Repository
  • 82 Watchers
  • 12 Stars
  • 3,486 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 20 Versions
  • 43 % Grown

The README.md

BetterDOMDocument

Build Status Code Coverage Scrutinizer Code Quality Dependency Status, (*1)

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath queries., (*2)

composer require highwire/better-dom-document

```php <?php, (*3)

use BetterDOMDocument\DOMDoc;, (*4)

// We can load a new BetterDOMDocument from either a string or a DOMNode object $dom = new DOMDoc($xmlstring);, (*5)

// It's easy to output the entire document as an array, which is sometimes easier to work with in PHP $array = $dom->getArray();, (*6)

// It's easy to query too! $node_list = $dom->xpath('//xpath/to/node', $optional_context_node);, (*7)

// If you know you're only going to find a single DOMNode, you can use a querySingle $dom_node = $dom->xpathSingle('//xpath/to/node');, (*8)

// Swapping out DOMNodes is really easy $dom->replace($dom_node, $replacementNode);, (*9)

// Removing a node is easy $dom->remove($dom_node);, (*10)

// Most places where you want to pass a DOMNode or element, you can just pass an xpath instead $dom->remove('//xpath/to/element/to/remove');, (*11)

// The same goes for replacments $dom->replace('//xpath/to/replace', 'You can pass a string, a DOMNode, or a document');, (*12)

// It's easy to output the XML $xml = $dom->out();, (*13)

// Or just output a single DOMNode $xml = $dom->out($dom_node);, (*14)

// Working with namespaced documents is made really easy $xml = ' Li Xu Li Xu ';, (*15)

// If your document (like the one above) has a default namespace, you should declare // it's prefix as the second value when constructing a new BetterDOMDocument $dom = new DOMDoc($xml, 'atom'); // We register the 'atom' prefix against the default namespace, (*16)

// Now we can do mixed namespace queries! $surname = $dom->querySingle('//atom:author/nlm:name/nlm:surname')->nodeValue;, (*17)

// If you need to register another namespace before doing a query, thats a snap. // Note that by default all namespace declarations in the root element are automatically registered. $dom->registerNamespace('kml','http://www.opengis.net/kml/2.2');, (*18)

// If you want to query with CSS selectors, no problem! $dom->select('nlm:name[@name-style="eastern"]');, (*19)

The Versions

29/09 2017

dev-2.x-dev

dev-2.x-dev https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

29/09 2017

2.1.6

2.1.6.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

22/08 2017

2.1.5

2.1.5.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

11/08 2017

2.1.4

2.1.4.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

25/07 2017

2.1.3

2.1.3.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

08/05 2017

2.1.2

2.1.2.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

02/05 2017

2.1.1

2.1.1.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

02/05 2017

2.0.9

2.0.9.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

20/04 2017

2.0.8

2.0.8.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Requires

 

The Development Requires

18/04 2017

2.0.7

2.0.7.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Requires

 

The Development Requires

18/04 2017

2.0.6

2.0.6.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Requires

 

The Development Requires

18/04 2017

2.0.5

2.0.5.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Requires

 

The Development Requires

18/04 2017

2.0.4

2.0.4.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Requires

 

The Development Requires

17/03 2017

2.x-dev

2.9999999.9999999.9999999-dev https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Requires

 

The Development Requires

17/03 2017

2.0.3

2.0.3.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Requires

 

The Development Requires

23/01 2017

dev-master

9999999-dev https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Development Requires

06/01 2017

2.0.2

2.0.2.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Development Requires

05/01 2017

2.0.1

2.0.1.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Development Requires

05/01 2017

2.0.0

2.0.0.0 https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Development Requires

09/12 2016

dev-utf8-loadHTML

dev-utf8-loadHTML https://github.com/highwire/opensource-php-BetterDOMDocument

BetterDOMDocument is a handy PHP utility class for working with XML. It's a wrapper for PHP's built in DOMDocument that provides a bunch of nice shortcuts that makes working with XML in PHP a breeze. It has great built-in support for namespaces, and xpath.

  Sources   Download

new-bsd

The Development Requires