PHP code example of mascame / formality

1. Go to this page and download the library: Download mascame/formality 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/ */

    

mascame / formality example snippets



$types = [
    'password' => [], // will match the keyword `password`
    'text' => [
        'autodetect' => [
            'title',  
        ]
    ],
    'textarea' => [
        'autodetect' => [
            'body',  
        ],
    ],
    'datetime' => [
        'regex' => [
            '/_at$/'
        ],
    ],
];

$parser = new Mascame\Formality\Parser\Parser($types);

print $parser->parse('title');  // text
print $parser->parse('body');  // textarea
print $parser->parse('created_at');  // datetime
print $parser->parse('password');  // password