ap-lib / normalizer
A library that normalizes some mixed variable to simple types: int, string, array, bool, null
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ap-lib/normalizer
Requires
- php: ^8.3
Requires (Dev)
- phpunit/phpunit: 10.5.*
This package is auto-updated.
Last update: 2025-10-07 07:34:22 UTC
README
A library that normalizes some mixed variable to simple types: int, string, array, bool, null
Installation
composer require ap-lib/normalizer
Features
- Allowed custom normalizers
Requirements
- PHP 8.3 or higher
Getting started
$normalizer = new BaseNormalizer([ new ThrowableNormalizer(include_trace: false) ]); $normalizedObject = $normalizer->normalize([ "message" => "some error message", "exception" => new Exception("file not found", 1543), ]); $normalizedArray = $normalizedObject->value; var_export($normalizedArray); /* [ 'message' => 'some error message', 'exception' => [ 'type' => 'Exception', 'message' => 'file not found', 'file' => '/code/path/to/file.php', 'line' => 19, 'code' => 1543, ], ] */