chillerlan / php-prototype-dom

prototype.js like DOM traversal and manipulation for PHP 7.4+.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chillerlan/php-prototype-dom

prototype.js like DOM traversal and manipulation for PHP 7.4+.

PHP Version Support version license Travis Coverage Scrunitizer Packagist downloads
CI phpDocs

Documentation

An API documentation created with phpDocumentor can be found at https://chillerlan.github.io/php-prototype-dom/ (WIP).

Requirements

Installation

requires composer

composer.json (note: replace dev-main with a version boundary)

{
	"require": {
		"php": "^7.4 || ^8.0",
		"chillerlan/php-prototype-dom": "dev-main"
	}
}

Profit!

Quickstart

use chillerlan\PrototypeDOM\Document;
use chillerlan\PrototypeDOM\Node\PrototypeHTMLElement;

$document = new Document(file_get_contents('https://www.php.net/supported-versions.php'));

$supportedVersions = $document->querySelectorAll('tr.stable > td:first-of-type > a')
	->map(fn(PrototypeHTMLElement $a):string => $a->value());

var_dump($supportedVersions); // -> ['7.4', '8.0']

About

prototype.js like DOM traversal and manipulation for PHP 7.4+.

License:MIT License


Languages

Language:PHP 97.7%Language:HTML 1.5%Language:Dockerfile 0.7%Language:Shell 0.1%