An open API service indexing awesome lists of open source software.

https://github.com/blockifywp/dom

Html DOM manipulation library for PHP
https://github.com/blockifywp/dom

Last synced: 5 months ago
JSON representation

Html DOM manipulation library for PHP

Awesome Lists containing this project

README

          

# Blockify DOM

DOM manipulation library for PHP.

## Installation

```bash
composer require blockify/dom
```

## Usage

### PHP

First, require Composer's autoloader:

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

Then, use the library:

```php
use Blockify\Dom\DOM;

$html = '

Hello, World!

';

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

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

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

echo $dom->saveHTML();
```