Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Simple Html Dom Parser Laravel Package

kub-at/php-simple-html-dom-parser

A fast, lightweight PHP HTML DOM parser that lets you find and extract elements from HTML using jQuery-like selectors. Compatible with simple_html_dom, it makes scraping, parsing, and manipulating markup easy with minimal code.

Deep Wiki
Context7

Technical Evaluation

  • Architecture fit: Suitable only as a narrow, server-side HTML parsing utility for scraping, extracting links/text, or normalizing small HTML fragments. It is not a sanitizer, not an HTML5-compliant browser engine, and should not become a core platform dependency.
  • Integration feasibility: Low initial integration effort. It is a Composer package with an MIT license and a simple str_get_html / file_get_html-style API, likely exposed as Kubat\PhpSimple\HtmlDomParser. Laravel does not need a service provider; wrap it behind an application-owned adapter.
  • Technical risk: High lifecycle risk. Last release was 2019-10-25, upstream activity is weak, and the PHP 7.3+ compatibility claim must be validated against the target Laravel/PHP matrix, especially PHP 8.x deprecations. The parser is in-process, memory-hungry for large documents, and may behave poorly on malformed or deeply nested HTML.
  • Security risk: Avoid the package’s remote-fetch helpers such as file_get_html for untrusted URLs. Fetch via Laravel’s HTTP client/Guzzle so SSRF controls, timeouts, redirects, TLS, and allowlists are enforceable. Do not treat parsed output as sanitized HTML.
  • Key questions:
    • What exact Laravel and PHP versions must be supported?
    • Is the need CSS-selector-style extraction, HTML5 parsing, or sanitization?
    • What are the input sources, trust levels, document sizes, and request volumes?
    • Can the team own a fork/patch path if PHP compatibility breaks?
    • Is a maintained alternative such as symfony/dom-crawler with masterminds/html5 acceptable?
  • TPM recommendation: Approve for a time-boxed spike or isolated legacy use case. Do not approve as a strategic dependency without an adapter boundary, compatibility tests, and a documented exit path.

Integration Approach

  • Stack fit: Fits Laravel service classes, jobs, commands, and queue workers as a pure PHP utility. No framework coupling, but also no Laravel-specific support, configuration, or observability.
  • Migration path: Introduce an application interface such as HtmlParser with a concrete SimpleHtmlDomParserAdapter. Keep package-specific calls out of controllers, models, and domain services. If the package fails validation, replace the adapter with Symfony DomCrawler/Masterminds HTML5 without changing callers.
  • Compatibility: Pin the package version, test on the exact PHP/Laravel matrix, and run representative HTML through it. Check for PHP deprecation notices, encoding issues, selector behavior, and memory growth in long-lived workers/Octane.
  • Sequencing:
    1. Confirm use case, input sources, document-size limits, and target PHP/Laravel versions.
    2. Run a non-production Composer install and compatibility spike.
    3. Build the adapter plus a fixture corpus of real and malformed HTML.
    4. Fetch remote content through Laravel HTTP client only; pass strings into the parser.
    5. Add config limits for bytes, nesting, timeout, and concurrency.
    6. Roll out behind a feature flag or in one bounded job before broader use.
    7. Decide whether to retain, fork, or replace based on test and operational results.

Operational Impact

  • Maintenance: High ownership burden relative to value. The package has low upstream activity and a 2019 release; the team should expect to patch PHP compatibility or fork it. MIT licensing makes a fork feasible but not free.
  • Support: Community support is limited. Internal documentation, tests, and an owner must compensate. Do not rely on upstream for security or compatibility fixes.
  • Scaling: Parsing is synchronous and in-process, with whole-document memory use. Scale through queue workers and horizontal workers, not by parsing large documents in request paths. Cap document size, worker concurrency, and parse duration.
  • Failure modes: Malformed HTML, encoding mismatches, null selector results, memory exhaustion, PHP deprecation/fatal errors, remote-fetch timeouts, and long-lived worker memory growth. Isolate parsing in jobs, call clear()/unset documents, and monitor duration, memory, and failure rate.
  • Ramp-up: Developers familiar with jQuery-like selectors will onboard quickly, but they must be trained on the adapter boundary, security limits, and the difference between parsing and sanitization. Operational runbooks should cover parser failures and fallback behavior.
  • Overall TPM view: The opportunity is real for low-complexity extraction, but the dependency is aged and weakly maintained. Use it only with strict isolation, explicit limits, and a planned replacement path.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk