php-extended/php-html-transformer-chain

A library with various ways to chain html transformers together


Keywords
php, html, transformer, Chain, implementation
License
MIT

Documentation

php-html-transformer-chain

A library with various ways to chain html transformers together.

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": "^2",
		...
	}

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).