Website · Validation rules · Playground · Implementations · Test suite
LIVR is a specification for describing data validation rules as plain data. Write the rules once and validate data the same way, with the same error codes, in JavaScript, Perl, PHP, Python, Go, Erlang and other languages.
{
name: 'required',
email: ['required', 'email'],
gender: { one_of: ['male', 'female'] },
phone: { max_length: 10 },
password: ['required', { min_length: 10 }],
password2: { equal_to_field: 'password' }
}- Rules are declarative and language independent
- Any number of rules for each field
- Validator should return together errors for all fields
- Exclude all fields that do not have validation rules described
- Possibility to validate complex hierarchical structures
- Easy to describe and understand validation
- Returns understandable error codes (neither error messages nor numeric codes)
- Easy to implement own rules (usually you will have several in every project)
- Rules should be able to change results output ("trim", "nested_object", for example)
- Multipurpose (user input validation, configs validation, contracts programming etc)
- Unicode support
| Language | Repository | Package | LIVR | Maintainer |
|---|---|---|---|---|
| JavaScript | koorchik/js-validator-livr, docs | npm: livr |
2.5 | @koorchik |
| Perl | koorchik/Validator-LIVR | CPAN: Validator::LIVR |
2.5 | @koorchik |
| PHP | WebbyLab/php-validator-livr | Packagist: validator/livr |
2.0 | @WebbyLab |
| Python | asholok/python-validator-livr | PyPI: LIVR |
2.0 | @asholok |
| Go | k33nice/go-livr | Go: github.com/k33nice/go-livr |
2.0 | @k33nice |
| Java | vlbaluk/java-validator-livr | Maven Central: io.github.vlbaluk:validator-livr |
2.0 | @vlbaluk |
| Ruby | fuksito/ruby-livr | RubyGems: ruby-livr |
2.0 | @fuksito |
| Erlang (Liver) | erlangbureau/liver | Hex: liver |
2.0 | @erlangbureau |
| Erlang (Olifer) | Prots/olifer | — | 2.0 | @Prots |
| Lua | fperrad/lua-LIVR | LuaRocks: lua-livr |
2.0 | @fperrad |
| Raku | koorchik/perl6-livr | raku.land: LIVR |
2.5 | @koorchik |
| Swift | olxbr/livr-swift-validator | CocoaPods: Livr |
2.0 | @olxbr |
| Dart | koorchik/dart-livr | pub.dev: livr |
2.5 | @koorchik |
| Rust | koorchik/rust-livr | crates.io: livr |
2.5 | @koorchik |
The latest LIVR version is 2.5: it adds rules to 2.0, the previous one (changelog, specification). The version before 2.0 is 0.4. Test suite results for every implementation are on the implementations page.
| Directory | Content |
|---|---|
docs/ |
The specification website (livr-spec.org), built with VitePress |
test_suite/ |
The test suite that every implementation runs (LIVR 2.0) |
test_suite_2.5/ |
The test suite of the rules added in LIVR 2.5 |
drafts/ |
The LIVR 2.5 specification (v2.5.md) and ideas for 3.0 |
conformance/ |
Runners that check the published implementations against the test suite |
To work on the website: npm install, then npm run docs:dev. See Improve this documentation.