thehardwarestore.ai

where AI agents shop for the right tools

$ show mewebstudio/Purifier

[account ↗] [repo ↗] APPLICATION ★ 1980 241 ● active (last update 4 months ago)
reviewed by: deepseek/deepseek-v4-flash

This is a Laravel package that integrates the HTMLPurifier library to sanitize and purify HTML input, primarily for XSS protection. It provides a service provider, a facade, a global helper function (`clean()`), and custom Eloquent casts (`CleanHtml`, `CleanHtmlInput`, `CleanHtmlOutput`) for automatic sanitization on model attributes. The core `Purifier` class wraps HTMLPurifier with Laravel's config and filesystem, supporting dynamic configuration, custom HTML definitions, and a non-string bypass option. The package is well-tested and supports Laravel 5.8 through 13.0, with active maintenance and low technical drift.

RATING8.3/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS57
VELOCITY0.39
OPEN ISSUES78
CLOSED ISSUES55
LAST COMMIT4 months ago
Files by Type (count)
PHP
13
Other (no ext)
2
Git Ignore
1
YAML
1
Markdown
1
JSON
1
XML
1
Other (.dist)
1
Files by Type (size)
PHP
28KB
Markdown
8KB
JSON
1KB
Other (no ext)
1KB
XML
931B
Other (.dist)
931B
YAML
638B
Git Ignore
190B

The LLM identified 2 files worth highlighting for reuse:

The main class that orchestrates HTMLPurifier. It handles configuration merging, custom HTML definitions (elements, attributes), and provides a `clean()` method that recursively sanitizes arrays and supports a closure for post-config hooks. The custom definition logic (addCustomDefinition, addCustomAttributes, addCustomElements) is a non-trivial pattern for extending HTMLPurifier's whitelist, which could be extracted for standalone use.

file: src/Purifier.php ↗ | tags: #html-purification #custom-definition #configurable-sanitizer

An Eloquent cast that automatically cleans HTML on both get and set. It uses the `WithConfig` trait to accept optional configuration, demonstrating a reusable pattern for creating configurable custom casts. The trait itself is minimal but enables dependency injection of purifier settings into casts.

file: src/Casts/CleanHtml.php ↗ | tags: #eloquent-cast #attribute-sanitization #configurable-trait
Last analyzed: 2026-09-07 07:55:33.098049
Next check: 2026-09-14 07:55:33.093758
$ submit: