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
Requires
- php: >=8.1
- asika/autolink: ^2.2
- illuminate/collections: ^11
- ivopetkov/html5-dom-document-php: ^2.10
Requires (Dev)
- laravel/pint: ^1.20
- pestphp/pest: ^3.7
- pestphp/pest-plugin-watch: ^3.0
- phpstan/phpstan: ^2.1
- symfony/var-dumper: ^7.2
This package is auto-updated.
Last update: 2026-01-11 22:18:54 UTC
README
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.