2017 © Pedro Peláez
 

library dom-utils

Utility functions for the PHP DOM extension

image

room11/dom-utils

Utility functions for the PHP DOM extension

  • Friday, March 24, 2017
  • by Danack
  • Repository
  • 30 Watchers
  • 1 Stars
  • 1,062 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 2 % Grown

The README.md

DOM Utils

Utility functions for the PHP DOM extension., (*1)

Required PHP Version

  • PHP 7.0+

Installation

$ composer require room11/dom-utils

Usage

default_charset

Gets and sets the default charset used by DOMUtils functions., (*2)

default_charset(string $charSet = ''): string

When the supplied $charSet is empty, just return the current value. When a new value is supplied, change the default and return the old one., (*3)

  • string $charSet - The new default character set.

domdocument_load_html

Loads a HTML string into a DOMDocument object, with error handling and character set normalization., (*4)

domdocument_load_html(string $html, int $options = 0, string $charSet = ''): \DOMDocument

Loads a HTML string into a DOMDocument object, with error handling and character set normalization., (*5)

  • string $html - The HTML string to load.
  • int $options - A bit mask of LibXML options to use when loading the document.
  • string $charSet - The character set to use when loading the document. Defaults to default_charset().

Throws a LibXMLFatalErrorException when loading the document fails., (*6)

domdocument_process_html_docs

Processes a set of HTML strings into DOMDocument objects and invokes a callback for each one., (*7)

domdocument_process_html_docs($htmlStrings, callable $callback, int $options = 0, string $charSet = ''): \DOMDocument

A DOMDocument object will be passed to the first argument of the callback, and an array of LibXMLError objects for the document to the second. The third argument is a boolean which is true if the document could not be loaded. The callback may return boolean false to break the iteration. Any other return value will be ignored., (*8)

  • string[] $htmlStrings - An iterable set of HTML strings to process.
  • callable(\DOMDocument, \LibXMLError[], bool) $callback - The callback to invoke for each document.
  • int $options - A bit mask of LibXML options to use when loading the documents.
  • string $charSet - The character set to use when loading the documents. Defaults to default_charset().

The Versions

24/03 2017

dev-master

9999999-dev

Utility functions for the PHP DOM extension

  Sources   Download

MIT

19/10 2016

v1.1.1

1.1.1.0

Utility functions for the PHP DOM extension

  Sources   Download

MIT

17/10 2016

v1.1.0

1.1.0.0

Utility functions for the PHP DOM extension

  Sources   Download

MIT

07/10 2016

v1.0.3

1.0.3.0

Utility functions for the PHP DOM extension

  Sources   Download

MIT

13/05 2016

v1.0.2

1.0.2.0

Utility functions for the PHP DOM extension

  Sources   Download

MIT

10/05 2016

v1.0.1

1.0.1.0

Utility functions for the PHP DOM extension

  Sources   Download

MIT

06/05 2016

v1.0.0

1.0.0.0

Utility functions for the PHP DOM extension

  Sources   Download

MIT