ap-lib / sanitizer
A library that sanitize some mixed variable to simple types: int, string, array, bool, null
Installs: 34
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ap-lib/sanitizer
Requires
- php: ^8.3
Requires (Dev)
- phpunit/phpunit: 10.5.*
This package is auto-updated.
Last update: 2025-10-11 06:03:22 UTC
README
A library that normalizes some mixed variable to simple types: int, string, array, bool, null
Installation
composer require ap-lib/sanitizer
Features
- Allowed custom sanitizers
Requirements
- PHP 8.3 or higher
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, ], ] */