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
- Host: GitHub
- URL: https://github.com/blockifywp/dom
- Owner: blockifywp
- Created: 2024-04-24T12:47:29.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T10:32:43.000Z (about 2 years ago)
- Last Synced: 2025-12-21T18:35:19.392Z (6 months ago)
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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();
```