<commit_before># Comfort

Ensure your data conforms (a shameless ripoff of [Joi](https://github.com/hapijs/joi)).

## Things to do:<commit_msg>Updated readme with example<commit_after># Comfort

Ensure your data conforms (a shameless ripoff of [Joi](https://github.com/hapijs/joi)).

# Example
```php
$json = <<<JSON
{
    "first_name": "Andres",
    "last_name": "Galindo",
    "email": "<EMAIL>",
    "address": {
        "street_addr1": "123 Joi lane",
        "city": "Miami",
        "state": "FL"
    }
}
JSON;

$stateArray = array(
    'AL'=>'ALABAMA',
    'AK'=>'ALASKA',
    'AS'=>'AMERICAN SAMOA',
    'AZ'=>'ARIZONA',
    'AR'=>'ARKANSAS',
    'CA'=>'CALIFORNIA',
    'CO'=>'COLORADO',
    'CT'=>'CONNECTICUT',
    'DE'=>'DELAWARE',
    'DC'=>'DISTRICT OF COLUMBIA',
    'FM'=>'FEDERATED STATES OF MICRONESIA',
    'FL'=>'FLORIDA',
    /** taken out for brevity */
);

$underwritingSchema = cmf()->json()->keys([
    "first_name" => cmf()->string()->required()->alpha()->min(1),
    "last_name"  => cmf()->string()->required()->alpha()->min(1),
    "email" => cmf()->string()->email(),
    "address"    => cmf()->array()->keys([
        "street_addr1" => cmf()->string()->required()->min(2),
        "street_addr2" => cmf()->string()->optional()->min(2),
        "city"         => cmf()->string()->required()->min(2),
        "state"        => cmf()->string()->alternatives([
            [
                'is' => cmf()->string()->length(2),
                'then' => cmf()->string()->anyOf(array_keys($stateArray)),
                'else' => cmf()->string()->anyOf(array_values($stateArray))
            ],
        ])
    ])
]);

$data = $underwritingSchema($json);
var_dump($data);
```

## Things to do:
{'fraction_non_alphanumeric': 0.24475524475524477, 'fraction_numerical': 0.006993006993006993, 'mean_word_length': 2.974537037037037, 'pattern_counts': {'":': 7, '<': 7, '<?xml version=': 0, '>': 58, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2689908', 'n_tokens_mistral': 616, 'n_tokens_neox': 604, 'n_words': 101}