Blockify DOM package.

dev-main 2024-05-01 10:32 UTC

This package is auto-updated.

Last update: 2024-10-31 00:41:56 UTC


README

DOM manipulation library for PHP.

Installation

composer require blockify/dom

Usage

PHP

First, require Composer's autoloader:

require_once __DIR__ . '/vendor/autoload.php';

Then, use the library:

use Blockify\Dom\DOM;

$html = '<h1>Hello, World!</h1>';

$dom = DOM::parse( $html );

$h1 = $dom->getElementsByTagName('h1')[0];

$h1->setAttribute('class', 'heading');

echo $dom->saveHTML();