icom/ framework

Make input explicit.

Small, strict validation rules with field-level errors and an allowlisted output.

Validate a payload

example
use Icom\Validation\Validator;

$result = (new Validator())->validate($input, [
    'name' => 'required|string|min:2|max:80',
    'email' => 'required|email|max:160',
    'age' => 'nullable|integer|min:0|max:150',
    'role' => 'required|in:reader,editor',
]);

return Response::json($result, $result['valid'] ? 200 : 422);

The result

example
{
  "valid": false,
  "data": {"name": "Alex"},
  "errors": {"email": ["Must be a valid email."]}
}

Rules

Available rules: required, present, nullable, string, integer, boolean, email, array, list, uuid, date:YYYY-MM-DD, confirmed, same:field, different:field, min:N, max:N and in:a,b. Integer and boolean rules require actual JSON integers/booleans; there is no implicit coercion. min/max measure integers when an integer rule is present, array/list rules count items; otherwise Unicode string length. Unknown rules and malformed limits throw configuration errors.

Use only validated values

Unknown input fields are omitted from data. Optional means a field may be absent; null requires nullable. Empty strings still undergo type/length validation unless required rejects them first. Validation is not authorization: enforce access policies before writing data. Nested schemas, file validation and locale-specific rule messages are not part of this release.

Developer preview — benchmark claims require reproducible evidence.

Explore the architecture