stevebauman/purify
Laravel wrapper for HTMLPurifier to sanitize user-submitted HTML and prevent XSS. Clean strings or arrays via the Purify facade, with support for per-call (dynamic) configuration and published config for app-wide rules.
class="safe-*"); consider custom regex or a dedicated parser."This package lets us safely enable rich user content (e.g., comments, articles) without exposing our app to XSS attacks. It’s like a ‘sanitization firewall’ for HTML—built into Laravel, so no extra dev time. For example, we can let users format text with Trix editor while blocking malicious scripts. It’s used by high-traffic sites like Basecamp, and the MIT license means no hidden costs."
Key Outcomes:
*"Purify wraps HTMLPurifier, a robust HTML sanitizer, with Laravel-friendly features:
Purify::clean($input) for strings/arrays.php artisan purify:clear).<figure> tags).PurifyHtmlOnGet).Trade-offs:
AutoFormat behavior).Quick Start:
composer require stevebauman/purify
php artisan vendor:publish --provider="Stevebauman\Purify\PurifyServiceProvider"
Then sanitize input:
$safeHtml = Purify::clean(request('content'));
```"*
How can I help you explore Laravel packages today?