### Install Laravel HTML Sanitizer
Source: https://github.com/jeffersongoncalves/laravel-html-sanitizer/blob/master/README.md
Install the package via Composer.
```bash
composer require jeffersongoncalves/laravel-html-sanitizer
```
--------------------------------
### Install and publish config for laravel-html-sanitizer
Source: https://github.com/jeffersongoncalves/laravel-html-sanitizer/blob/master/resources/boost/skills/html-sanitizer-development/SKILL.md
Install the package with Composer. Publish the config file only when you need to adjust the allowlist; the package ships with safe defaults.
```bash
composer require jeffersongoncalves/laravel-html-sanitizer
```
```bash
php artisan vendor:publish --tag="html-sanitizer-config"
```
--------------------------------
### Sanitize HTML with HtmlSanitizer::clean()
Source: https://github.com/jeffersongoncalves/laravel-html-sanitizer/blob/master/README.md
Sanitize untrusted HTML by passing it through HtmlSanitizer::clean(). The example shows a dirty string with a script and an onerror attribute, and the resulting clean output.
```php
use JeffersonGoncalves\HtmlSanitizer\HtmlSanitizer;
$dirty = '
Hello
';
$clean = HtmlSanitizer::clean($dirty);
// Hello
```
--------------------------------
### Run tests, static analysis, and formatting
Source: https://github.com/jeffersongoncalves/laravel-html-sanitizer/blob/master/resources/boost/skills/html-sanitizer-development/SKILL.md
Run the test suite, static analysis, and code formatting for the project. Use `vendor/bin/pest` for tests, `--coverage` for coverage, `vendor/bin/phpstan analyse` for static analysis, and `vendor/bin/pint` for formatting.
```bash
# Run all tests
vendor/bin/pest
# Run with coverage
vendor/bin/pest --coverage
# Static analysis
vendor/bin/phpstan analyse
# Code formatting
vendor/bin/pint
```
--------------------------------
### Configure HtmlSanitizerConfig with default allowlist
Source: https://github.com/jeffersongoncalves/laravel-html-sanitizer/blob/master/resources/boost/skills/html-sanitizer-development/SKILL.md
Build the default sanitizer configuration. allowSafeElements() enables the curated presentational set; class/id are kept on every element; width/height are scoped to
; data is deliberately excluded from media schemes because a data:image/svg+xml URI can carry executable script. max_input_length defaults to ~2 MB to bound work on a hostile payload; set -1 to disable the cap. Everything not allowed — ');
expect($clean)
->not->toContain('