PHP code example of phramework / validate-filler

1. Go to this page and download the library: Download phramework/validate-filler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phramework / validate-filler example snippets



$validator = \Phramework\Validate\ObjectValidator::createFromJSON('{
  "type": "object",
  "properties": {
    "a": {
      "type": "string",
      "enum": [
        "1",
        "2",
        "3"
      ]
    },
    "b": {
      "type": "string",
      "enum": [
        "i",
        "ii",
        "iii"
      ]
    }
  },
  "

class stdClass#1381 (1) {
  public $a =>
  string(1) "2"
}

class stdClass#1381 (2) {
  public $a =>
  string(1) "3"
  public $b =>
  string(2) "ii"
}


$validator = new \Phramework\Validate\ObjectValidator(
    (object) [
        'a' => new \Phramework\Validate\EnumValidator([
            '1',
            '2',
            '3'
        ]),
        'b' => new \Phramework\Validate\EnumValidator([
            'i',
            'ii',
            'iii'
        ])
    ],
    ['a'],
    false
);

$value = (new \Phramework\ValidateFiller\Filler())
    ->fill($validator);