villermen / data-handling
Library for general data sanitization and validation.
v2.1.0
2026-06-28 02:24 UTC
Requires
- php: >=8.3
- ext-ctype: *
Requires (Dev)
- phpunit/phpunit: ^12.0
README
PHP library with general data sanitization and formatting utilities. Contains utility methods not otherwise contained in framework components that I see myself needing at times. My "functions.php", if you will.
Examples
Clean::text('<p>dirty &emdash; nasty<br>html</p>'); // "dirty — nasty html" Clean::text('<p>dirty &emdash; nasty<br>html</p>', ['br']); // "dirty — nasty<br>html" Clean::alphanumeric('proteïne shake'); // "proteineshake" Clean::alphanumeric('proteïne shake', ' '); // "proteine shake" Clean::slug('ßÈÿ žÐ-'); // "ssey-zdj" Clean::digits("1 abc 23\n4") // "1234" Path::format('/././//.///path//to\\file'); // "/path/to/file" Path::merge('/root/directory', '/relative/path'); // "/root/directory/relative/path" Path::makeRelative('/root/directory', '/root/directory/relative/path') // "relative/path" Path::formatFilesize(1436549120); // "1.34 GiB" Filter::match('file23.txt', 'file*.txt') // true
Installation
composer require villermen/data-handling