This repository was archived by the owner on Feb 19, 2026. It is now read-only.
Releases: caltechlibrary/safer-php
Releases · caltechlibrary/safer-php
0.0.3, legacy release
Updated safer.php and safer_test.php to PHP 8.3. This release for done to support porting legacy etd-workflow repository to run under PHP 8.3.
Full Changelog: v0.0.2...v0.0.3
Enforce Defaults option
The safer() function now has an enforceDefaults option. If true then keys defined in the validation map are will be returned with defaults values in the associative array from calls to safer().
$a = safer([], [
'i' => 'integer',
'name' => 'text',
], false, true);
print('i is ' . $a['i'] . ' (zero) and name is "' . $a['name'] . '" (an empty string)' . PHP_EOL);This would display something like
i is 0 (zero) and name is "" (an empty string)
Initial proof of concept
This is a tiny library for retrofitting legacy PHP apps with some simple input vetting.