Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PHP
  3. DiDOM

DiDOM

MITPHP2.0.1

A simple and fast HTML and XML parser for PHP with CSS selector and XPath support.

GitHubGitHub
2.2k stars197 forks0 contributors

What is DiDOM?

DiDOM is a PHP library for parsing HTML and XML documents, designed for simplicity and performance. It provides a fluent API for navigating and manipulating document elements, making web scraping and data extraction tasks straightforward.

Target Audience

PHP developers who need to parse, scrape, or manipulate HTML/XML documents, particularly those working on web scraping, data extraction, or document transformation projects.

Value Proposition

Developers choose DiDOM for its clean, object-oriented API that supports both CSS selectors and XPath queries, along with built-in caching for performance and intuitive methods for element manipulation and output formatting.

Overview

Simple and fast HTML and XML parser

Use Cases

Best For

  • Web scraping tasks where you need to extract data from HTML pages using CSS selectors or XPath.
  • Parsing and manipulating XML documents in PHP with a fluent, object-oriented interface.
  • Automating data extraction from websites by loading HTML from URLs, files, or strings.
  • Modifying HTML/XML document structures, such as adding, replacing, or removing elements and attributes.
  • Generating formatted HTML or XML output from parsed documents for reporting or further processing.
  • Improving performance in repeated parsing operations through its caching mechanism for compiled XPath expressions.

Not Ideal For

  • Scraping websites that rely heavily on client-side JavaScript to load content
  • Projects requiring built-in HTTP client features like session management or automatic retries
  • Applications that need strict XML validation against DTD or XSD schemas
  • Teams looking for a visual or GUI-based tool for HTML editing and manipulation

Pros & Cons

Pros

CSS and XPath Support

Supports both CSS selectors and direct XPath queries, with automatic CSS-to-XPath conversion for familiar syntax and flexibility in document traversal.

Fluent Element Manipulation

Provides intuitive methods like setInnerHtml, replace, and remove for easy document changes, as shown in the README's 'Changing content' section.

Performance with Caching

Caches compiled XPath expressions to improve speed on repeated queries, enhancing efficiency for scraping tasks that involve multiple similar operations.

Flexible Document Loading

Loads HTML/XML from strings, files, or URLs with configurable encoding and libxml options, supporting various input sources out of the box.

Cons

No JavaScript Execution

Cannot parse or interact with dynamically loaded content, making it ineffective for modern websites that rely on client-side rendering.

Manipulation Caveats

Element replacement and removal only work if elements are found directly in the document, leading to potential confusion and bugs, as warned in the README.

Limited HTTP Features

Basic URL loading without integrated support for sessions, cookies, or advanced HTTP client capabilities, requiring additional libraries for complex scraping.

Sparse Ecosystem

Has fewer community extensions and integrations compared to alternatives like Symfony DomCrawler, limiting ready-made solutions for common scraping challenges.

Frequently Asked Questions

Quick Stats

Stars2,195
Forks197
Contributors0
Open Issues25
Last commit8 months ago
CreatedSince 2015

Tags

#dom-manipulation#css-selectors#php-library#dom#html#xml-parser#xml#web-scraping#html-parser#data-extraction#parser#xpath

Built With

P
PHP
l
libxml

Included in

PHP32.5k
Auto-fetched 1 day ago

Related Projects

Symfony PantherSymfony Panther

A browser testing and web crawling library for PHP and Symfony

Stars3,070
Forks234
Last commit20 days ago
Chrome PHPChrome PHP

Instrument headless chrome/chromium instances from PHP

Stars2,682
Forks324
Last commit3 months ago
CrawlerDetectCrawlerDetect

🕷 CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent

Stars2,407
Forks282
Last commit3 days ago
EmbedEmbed

Get info from any web service or page

Stars2,139
Forks324
Last commit3 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub