ecommit/scalar-values
Tiny PHP utility to validate and filter arrays of scalar values. Check whether an array contains only scalars (string/int/float/bool/null), or remove non-scalar items at the root level and return the cleaned array.
filterScalarValues), reducing memory overhead and improving processing speed for large datasets.Adopt if:
FormRequest or middleware).Look elsewhere if:
Respect/Validation or Laravel’s built-in validators.For Executives: "This tiny, MIT-licensed PHP package lets us automatically validate and clean user/input data to ensure only simple values (strings, numbers, booleans) are processed—no nested objects or arrays. It’s like a ‘scalar-only’ gatekeeper for our APIs and data pipelines. By catching invalid data early, we reduce bugs, improve performance, and save dev time that would otherwise go into custom validation logic. Zero dependencies, zero cost, and it integrates seamlessly with Laravel."
For Engineers: *"Need to ensure an array only contains scalars (no objects/arrays)?
ScalarValues::containsOnlyScalarValues($array) → bool.ScalarValues::filterScalarValues($array) → strips non-scalars in one pass.
Lightweight, no bloat, and works great in Laravel’s request lifecycle (e.g., middleware or FormRequest validation). Perfect for APIs, configs, or data migration scripts where you want to fail fast on malformed input."*How can I help you explore Laravel packages today?