Download the PHP package kariricode/sanitizer without Composer
On this page you can find all versions of the php package kariricode/sanitizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download kariricode/sanitizer
More information about kariricode/sanitizer
Files in kariricode/sanitizer
Download kariricode/sanitizer
More information about kariricode/sanitizer
Files in kariricode/sanitizer
Vendor kariricode
Package sanitizer
Short Description Composable, rule-based data sanitization engine for PHP 8.4+ — 33 rules, #[Sanitize] attributes, XSS prevention, powered by kariricode/property-inspector. ARFA 1.3.
License MIT
Homepage https://kariricode.org
Package sanitizer
Short Description Composable, rule-based data sanitization engine for PHP 8.4+ — 33 rules, #[Sanitize] attributes, XSS prevention, powered by kariricode/property-inspector. ARFA 1.3.
License MIT
Homepage https://kariricode.org
Please rate this library. Is it a good library?
Informations about the package sanitizer
KaririCode Sanitizer
[](https://github.com/KaririCode-Framework/kariricode-sanitizer/actions/workflows/ci.yml)
[](https://www.php.net/)
[](LICENSE)
[](https://phpstan.org/)
[](https://github.com/KaririCode-Framework/kariricode-sanitizer/actions)
[](https://github.com/KaririCode-Framework/kariricode-sanitizer/actions)
[](docs/spec/SPEC-002-rule-reference.md)
[](https://kariricode.org)
[](https://kariricode.org)
**Composable, rule-based data sanitization engine for PHP 8.4+ — 33 rules, zero dependencies.**
[Installation](#installation) · [Quick Start](#quick-start) · [Attribute DTO](#attribute-driven-dto-sanitization) · [All Rules](#all-33-rules) · [Architecture](#architecture) · [Docs](docs/README.md)
The Problem
Raw user input arrives dirty — whitespace, wrong case, dangerous HTML, unformatted documents — and cleaning it is always ad-hoc:
The Solution
Requirements
| Requirement | Version |
|---|---|
| PHP | 8.4 or higher |
| kariricode/property-inspector | ^2.0 |
Installation
Quick Start
Attribute-Driven DTO Sanitization
Modification Tracking
Every change is logged with before/after values — full audit trail for free:
XSS Prevention
Brazilian Document Formatting
All 33 Rules
| Category | Count | Aliases |
|---|---|---|
| String | 12 | trim, lower_case, upper_case, capitalize, slug, truncate, normalize_whitespace, normalize_line_endings, pad, replace, regex_replace, strip_non_printable |
| HTML | 5 | strip_tags, html_encode, html_decode, html_purify, url_encode |
| Numeric | 4 | to_int, to_float, clamp, round |
| Type | 3 | to_bool, to_string, to_array |
| Date | 2 | normalize_date, timestamp_to_date |
| Filter | 4 | digits_only, alpha_only, alphanumeric_only, email_filter |
| Brazilian | 3 | format_cpf, format_cnpj, format_cep |
See SPEC-002 for full parameter reference.
Rule Parameters
Custom Rules
Ecosystem Position
The Sanitizer cleans data — removes noise while preserving semantic meaning.
Key property: idempotency — sanitize(sanitize(x)) = sanitize(x).
Contrast with the Transformer, which converts representation and may change type.
Architecture
Source layout
Key design decisions
| Decision | Rationale | ADR |
|---|---|---|
| Alias-based rule registry | Flat names (trim), no FQCN coupling, custom aliases |
ADR-001 |
| Property Inspector integration | Delegates reflection and caching to kariricode/property-inspector |
ADR-002 |
Immutable SanitizationContext |
Thread safety, no cross-rule parameter pollution | ADR-003 |
| ARFA passthrough contract | Non-matching types returned unchanged — rules never coerce | ADR-004 |
| Zero-dependency rules | All 33 rules use only PHP built-ins | ADR-005 |
Specifications
| Spec | Covers |
|---|---|
| SPEC-001 | Engine contract, sanitize flow, result API |
| SPEC-002 | All 33 rules — aliases, parameters, defaults |
| SPEC-003 | #[Sanitize] attribute shape and DTO flow |
Project Stats
| Metric | Value |
|---|---|
| PHP source files | 51 |
| Source lines | ~2,100 |
| Test files | 20 |
| Test lines | ~1,938 |
| Tests | 175 passing |
| Assertions | 425 |
| Coverage | 100% (48 classes) |
| External runtime dependencies | 1 (kariricode/property-inspector) |
| Rule classes | 33 |
| Rule categories | 7 |
| PHPStan level | 9 (0 errors) |
| Psalm | 100% type inference (0 errors) |
| PHP version | 8.4+ |
| ARFA compliance | 1.43 V4.0 |
Contributing
License
Walmir Silva
Part of the **[KaririCode Framework](https://kariricode.org)** ecosystem.
[kariricode.org](https://kariricode.org) · [GitHub](https://github.com/KaririCode-Framework/kariricode-sanitizer) · [Packagist](https://packagist.org/packages/kariricode/sanitizer) · [Issues](https://github.com/KaririCode-Framework/kariricode-sanitizer/issues)
All versions of sanitizer with dependencies
PHP Build Version
Package Version
The package kariricode/sanitizer contains the following files
Loading the files please wait ...