2017 © Pedro Peláez
 

library validator

Schemation Validator is powerful validator of various data structures.

image

schematicon/validator

Schemation Validator is powerful validator of various data structures.

  • Friday, June 8, 2018
  • by hrach
  • Repository
  • 4 Watchers
  • 17 Stars
  • 5,175 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 5 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

Schematicon Validator (PHP)

Build Status Downloads this Month Stable version, (*1)

Validator is Schematicon Schema validator. Schemeaticon schema is innovative declarative language for data structure description. It is programming-language independent; that means you can define the schema using NEON, YAML or native PHP arrays., (*2)

Example

my_family.neon:, (*3)

type: map
properties:
    name: string
    surname: string
    sex:
        enum: [male, female]
    age: int|null # property may be a null
    ?height: float # property may not exist at all; if exist, it has to be a float
    siblings:
        type: array
        item:
            type: string

The following inputs may be validated againts the defined schema:, (*4)

$normalizer = new Schematicon\Validator\Normalizer();
$schema = Neon\Neon::decode(file_get_contents('./my_family.neon'));
$schema = $normalizer->normalize($schema);
$validator = new Schematicon\Validator\Validator($schema);

$result = $validator->validate([
    'name' => 'jon',
    'surname' => 'snow',
    'sex' => 'male',
    'age' => 18,
    'height' => 180.00,
    'siblings' => ['Arya'],
]);

$result->isValid(); // true
$result->getErrors(); // []

Installation

Use composer:, (*5)

$ composer require schematicon/validator

License

MIT. See full license., (*6)

The development was sponsored by Sygic Travel., (*7)

The Versions

08/06 2018

dev-master

9999999-dev https://github.com/schematicon/validator-php

Schemation Validator is powerful validator of various data structures.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

validator structure schematicon

17/01 2018

dev-int-to-float

dev-int-to-float https://github.com/schematicon/validator-php

Schemation Validator is powerful validator of various data structures.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

validator structure schematicon

06/09 2017

v1.1.0

1.1.0.0 https://github.com/schematicon/validator-php

Schemation Validator is powerful validator of various data structures.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

validator structure schematicon

18/05 2017

v1.0.0

1.0.0.0 https://github.com/schematicon/validator-php

Schemation Validator is powerful validator of various data structures.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

validator structure schematicon