PHP code example of glebstar / sanitizer

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

    

glebstar / sanitizer example snippets




use Glebstar\Sanitizer\Sanitizer;

class Example
{
    public function testSanitize()
    {
        $sanitizer = new Sanitizer();
        $filters = [
            'foo' => 'integer',
            'bar' => 'string',
            'baz' => 'phone',
        ];
        $data = json_encode([
            'foo' => '123',
            'bar' => 'asd',
            'baz' => '8 (950) 288-56-23',
        ]);
    
        $result = $sanitizer->sanitize($filters, $data);
    }
}