PHPackages                             kurothing/kurovalidator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. kurothing/kurovalidator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

kurothing/kurovalidator
=======================

Simple, Easy, and Powerful Validation Library

v0.2.0(10y ago)025MITPHP

Since Oct 21Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Nikey646/KuroValidator)[ Packagist](https://packagist.org/packages/kurothing/kurovalidator)[ Docs](https://github.com/Nikey646/KuroValidator)[ RSS](/packages/kurothing-kurovalidator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

KuroValidator
=============

[](#kurovalidator)

A simple, and easy to use Validation Library for PHP.

Define Rules to check user input automatically based on a simple to use configuration.

Installing
==========

[](#installing)

Only composer is directly supported.

```
{
	"require": {
		"kurothing/kurovalidator": "0.1.*"
	}
}
```

or run the command `composer require "kurothing/kurovalidator" 0.1.*`

Usage
=====

[](#usage)

KuroValidator was designed with ease of use in mind, as such it takes 2 Parameters, Input Data and Configuration Data.

The Input Data is simple and easy to understand, just pass your information source. The Configuration Data is slightly more complex, but easy to understand once you get the gist of what is going on. Lets look at a basic example of validating the $\_GET.

```
use KuroThing\KuroValidator\Validator;

$validator = new Validator();

$result = $validator->validate($_GET, [
	"field" => [
		"rules" => [
			"rule"	=> "rule setting",
			"rule2"	=> [
				"MultiValue"	=> "settings",
				"AreSupported"	=> true,
			],
		],
	],
]);

if ($result->passes()) {
	// Passes
} else {
	// Fails
}

// Or the reverse
if ($result->fails()) {
	// Fails
} else {
	// Passes
}
```

Most of the code is self-explaining, but lets look over the second parameter of the `validate()` function.

The top level value, "field" is what we are validating against in the $\_GET super global. So if we wanted to validate the `id` query parameter, then we would replace "field" with "id".

The value of "field" is an array, which defines the rules, the name and allows you to override the `canSkip` and `message` values of a rule. We'll look into overriding those later and setting the name later, lets focus on explaining how the rules are defined.

As you can see, the "rules" element is an array containing all the rules we will use. Each rule is defined by `"name" => "settings"`, and rules with no settings do not require any value. Single Setting and Multi-Setting rules are both supported, and shown. With multi-setting rules, they require an associate array, with the key being the name of the setting, and the value being the value of the setting.

Preexisting Rules
=================

[](#preexisting-rules)

Rule ClassNameOptionsOption NamesDescriptionAlphaNumericDashRulealphanumericdash0Ensures only A-Z (ci), 0-9, and -/\_ is in the stringAlphaNumericRulealphanumeric0Ensures only A-Z (ci) and 0-9 is in the stringAlphaRulealpha0Ensures only A-Z (ci) is in the stringArrayRulearray0Ensures that the value is an ArrayBetweenRulebetween2lower, higherChecks to make sure the number is between the provided valuesBooleanRulebool0Checks to make sure the value is a Boolean. Does not work on strings, which Forms provide by default.CheckedRulechecked0Checks to see if the value is "true", "1", "yes", or "on".DateRuledate0Checks to see if a value is a valid date.EmailRuleemail0Checks to see if the email is a valid [RFC 822](https://www.ietf.org/rfc/rfc0822.txt) email addressIpRuleip0Ensures the value is an ipMatchesRulematches2field, fieldNameChecks to see if the current Field matches AnotherMaxRulemax1maxChecks to see if the string is longer than the setting, or if a number is larger.MinRulemin1minChecks to see if the string is shorter than the setting, or if a number is smaller.NumericRulenumber0Ensures that the value is a number.RegexRuleregex1patternChecks the value against the supplied patternRequiredRulerequired0Ensures the value is provided.UrlRuleurl0Ensures the value is a valid [RFC 2396](https://www.ietf.org/rfc/rfc2396.txt) uri.More Information
================

[](#more-information)

I'll provide more examples and documentation (such as creating new rules) at a later date.

Credits
=======

[](#credits)

- Original Concept and Implementation - [Violin](https://github.com/alexgarrett/violin).
    - Some rules are based off of the Implementation for them in Violin, and as such marked with "Credits: " and a link to the file on Github. These rules are AlphaNumericDash, AlphaNumeric, Alpha, Date, and Required. Some rules may match or be similar to Violin, however Violin's implementation was not used.
- AnonymousClass - [Mihailoff](https://gist.github.com/Mihailoff/3700483)
    - Used to dynamically create (lazy) rules at run time, rather than using the Class/Interface based implementation.

Copyrights
==========

[](#copyrights)

Copyright (c) 2015 \[Nikey646\] () 2015 \[Alex Garrett\] ()

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~0 days

Total

2

Last Release

3862d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c91c7506aa6a5e1f8f86dc61d446809a298af8c50d952e88c5e6df7c91ef4586?d=identicon)[nikey646](/maintainers/nikey646)

---

Top Contributors

[![Nikey646](https://avatars.githubusercontent.com/u/7837522?v=4)](https://github.com/Nikey646 "Nikey646 (9 commits)")

---

Tags

validation

### Embed Badge

![Health badge](/badges/kurothing-kurovalidator/health.svg)

```
[![Health](https://phpackages.com/badges/kurothing-kurovalidator/health.svg)](https://phpackages.com/packages/kurothing-kurovalidator)
```

###  Alternatives

[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k489.6M672](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k148.7M416](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

64736.9M186](/packages/opis-json-schema)[giggsey/libphonenumber-for-php-lite

A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber

8912.9M47](/packages/giggsey-libphonenumber-for-php-lite)

PHPackages © 2026

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