wishthis/vendor/oscarotero/html-parser
2023-12-19 15:31:43 +01:00
..
.github/workflows Update dependencies 2023-02-08 13:36:32 +01:00
src chore(dependencies): update composer 2023-12-19 15:31:43 +01:00
CHANGELOG.md chore(dependencies): update composer 2023-12-19 15:31:43 +01:00
composer.json Install github api 2022-01-21 09:23:52 +01:00
LICENSE Install github api 2022-01-21 09:23:52 +01:00
README.md Install github api 2022-01-21 09:23:52 +01:00

HTML parser

Simple utility to parse html strings to DOMDocument.

composer require oscarotero/html-parser

Usage

use HtmlParser\Parser;

$html = '<html><head></head><body>Hello world</body></html>';

//Convert a string to a DOMDocument
$document = Parser::parse($html);

//Convert a string to a DOMDocumentFragment
$fragment = Parser::parseFragment('<p>Hello world</p>');

//Convert a DOMDocument or DOMDocumentFragment to a string
echo Parser::stringify($document);
echo Parser::stringify($fragment);