PHPackages                             waughj/verified-arguments - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. waughj/verified-arguments

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

waughj/verified-arguments
=========================

Class for generating special type of associative array/map with fallback default values, validity tests, and sanitizers.

v1.0.0(5y ago)01.5k5GPL-2.0-or-laterPHPPHP &gt;=7.4

Since Oct 24Pushed 5y agoCompare

[ Source](https://github.com/waughjai/verified-arguments)[ Packagist](https://packagist.org/packages/waughj/verified-arguments)[ RSS](/packages/waughj-verified-arguments/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (5)

Verified Arguments
==================

[](#verified-arguments)

Class for generating special type of associative array/map with fallback default values, validity tests, and sanitizers.

Use
---

[](#use)

Takes in associative array of custom values, associative array of default values, and boolean determining whether a new value can be set without a default set.

Default values are fallbacks for keys whose values are not custom-set. If neither a default nor custom value is set for a key, trying to get the value of that key returns null. The custom value is only set if it follows the tests and types specified for that default. Tests can be any callable and types must be strings representing the type name. Tests and types can be either singular or lists. A custom-set value must pass all tests in a list and must be at least 1 of the types in a list. Otherwise, the set value with fallback to the default value or to null if no default value is given.

Defaults also have sanitizer, which will be applied to any custom-set values before set. Sanitizers can be any callable and can be singular or an array of callables, which will all be applied to the value in the order given. ( The 2nd sanitizer will sanitize the output of the 1st sanitizer, the 3rd the 2nd, &amp; so on ).

Example
-------

[](#example)

```
use WaughJ\VerifiedArguments;

$defaults =
[
    "name" => [ "value" => "Anonymous", "type" => "string", "sanitizer" => "strtoupper" ],
    "age" => [ "type" => "integer" ],
    "birthday" => [ "type" => \DateTime::class ]
];
$values = [ "name" => "Jaimeson", "age" => "old", "city" => "SeaTac" ];
$args = new VerifiedArguments( $values, $defaults );

echo( $args->get( "name" ) ); // Will print "JAIMESON".

echo( $args->get( "age" ) ); // Will print null.

echo( $args->get( "city" ) ); // Will print "SeaTac".

```

Changelog
---------

[](#changelog)

### 1.0.0

[](#100)

- Implement custom tests and sanitizers.
- Add flag for blocking custom values without defaults set.

### 0.6.0

[](#060)

- Add ability to get list from object

### 0.5.0

[](#050)

- 1st beta.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~446 days

Total

3

Last Release

1868d ago

Major Versions

0.6.0 → v1.0.02021-04-03

PHP version history (2 changes)0.5.0PHP &gt;=7.0

v1.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11161078?v=4)[waughj](/maintainers/waughj)[@waughj](https://github.com/waughj)

---

Top Contributors

[![jjwmezun](https://avatars.githubusercontent.com/u/24711797?v=4)](https://github.com/jjwmezun "jjwmezun (1 commits)")

---

Tags

arraytestsargumentssanitizers

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/waughj-verified-arguments/health.svg)

```
[![Health](https://phpackages.com/badges/waughj-verified-arguments/health.svg)](https://phpackages.com/packages/waughj-verified-arguments)
```

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.2k412.9k11](/packages/aimeos-map)

PHPackages © 2026

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