php-extended/php-html-transformer-chain

This package is abandoned and no longer maintained. The author suggests using the php-extended/php-html-transformer-object package instead.

A library with various ways to chain html transformers together

3.1.17 2021-06-24 22:25 UTC

README

A library with various ways to chain html transformers together.

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-html-transformer-chain": "^3",
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

To filter a dom node, do the following :


use PhpExtended\HtmlTransformerChain;

/* @var $dom \PhpExtended\Html\HtmlAbstractNodeInterface */
$filter = new HtmlTransformerChain([
	// $myTransformer1, // instanceof HtmlTransformerInterface
	// $myTransformer2, // instanceof HtmlTransformerInterface
]);
$filtered = $filter->transform($dom);
// $filtered instanceof \PhpExtended\Html\HtmlAbstractNodeInterface
// but passed through all the transformers

License

MIT (See license file).