php-extended/php-html-transformer-chain

A library with various ways to chain html transformers together

2.0.1 2020-03-26 23:56 UTC

This package is auto-updated.

Last update: 2020-03-26 22:57:10 UTC


README

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