PHPackages                             ap-lib/sanitizer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ap-lib/sanitizer

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

ap-lib/sanitizer
================

A library that sanitize some mixed variable to simple types: int, string, array, bool, null

036PHP

Since Mar 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ap-lib/sanitizer)[ Packagist](https://packagist.org/packages/ap-lib/sanitizer)[ RSS](/packages/ap-lib-sanitizer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AP\\Sanitizer
=============

[](#apsanitizer)

[![MIT License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

A library that normalizes some mixed variable to simple types: int, string, array, bool, null

Installation
------------

[](#installation)

```
composer require ap-lib/sanitizer
```

Features
--------

[](#features)

- Allowed custom sanitizers

Requirements
------------

[](#requirements)

- PHP 8.3 or higher

Getting started
---------------

[](#getting-started)

```
$sanitizer = new BaseSanitizer([
    new ThrowableSanitizer(include_trace: false)
]);

$sanitizedObject = $sanitizer->sanitize([
    "message"   => "some error message",
    "exception" => new Exception("file not found", 1543),
]);

$sanitizedArray = $sanitizedObject->value;

var_export($sanitizedArray);
/*
[
    'message'   => 'some error message',
    'exception' =>
        [
            'type'    => 'Exception',
            'message' => 'file not found',
            'file'    => '/code/path/to/file.php',
            'line'    => 19,
            'code'    => 1543,
        ],
]
*/
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1215fe5ecc9ba0ab1c730d3c992125cf6ebf460562e66be71ebae127789d465a?d=identicon)[AntonPanfilov](/maintainers/AntonPanfilov)

---

Top Contributors

[![anton-panfilov](https://avatars.githubusercontent.com/u/1083546?v=4)](https://github.com/anton-panfilov "anton-panfilov (2 commits)")

### Embed Badge

![Health badge](/badges/ap-lib-sanitizer/health.svg)

```
[![Health](https://phpackages.com/badges/ap-lib-sanitizer/health.svg)](https://phpackages.com/packages/ap-lib-sanitizer)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
