PHP code example of jawira / sanitizer

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

    

jawira / sanitizer example snippets


use Jawira\Sanitizer\Attribute as Filter;

class User {
    #[Filter\Trim]
    #[Filter\Title]
    public string $name;
}

use Jawira\Sanitizer\Sanitizer;

$user = new User();
$user->name = ' BOB ';

$sanitizer = new Sanitizer();
$sanitizer->sanitize($user);

echo $user->name; // 'Bob'