hirasso/html-processor

A tiny HTML processor written in PHP 🐘

Fund package maintenance!
hirasso

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/hirasso/html-processor

v0.0.4 2026-01-11 22:00 UTC

This package is auto-updated.

Last update: 2026-01-11 22:18:54 UTC


README

Latest Version on Packagist Test Status Code Coverage

A tiny HTML processor written in PHP 🐘

Features

  • Fluent API
  • Understands HTML5
  • Optimized for performance
  • Extensively tested

Installation

composer require hirasso/html-processor

Usage

use Hirasso\HTMLProcessor\HTMLProcessor;

echo HTMLProcessor::fromString($html)
    ->autolink() // wrap raw url strings in `<a>` tags
    ->localizeQuotes('de_DE') // localize quotes based on locale
    ->processLinks() // mark link types via class attribute (mailto:, tel:, internal, external, ...)
    ->beautify() // remove empty paragraphs, prevent widows
    ->linkToSocial('#', 'https://bsky.app/hashtag') // automatically link #hashtags to Bluesky
    ->encodeEmails(); // encode emails to confuse spam bots

Browse the tests/Feature folder for more usage examples.