PHP code example of mawuekom / laravel-request-sanitizer

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

    

mawuekom / laravel-request-sanitizer example snippets


class StoreUserDataRequest extends FormRequest
{
     use InputSanitizer;
     
     protected $sanitizers = [
        'name' => [
            Uppercase::class,
        ],
        'first_name' => [
            CapitalizeEachWords::class,
        ],
        'phone_number' => [
            RemoveNonNumeric::class
        ],
     ];
}

 {
    protected $sanitizers = [
        'last_name' => [
            FilterVars::class => [
                'filter' => FILTER_SANITIZE_STRING,
                'options' => FILTER_FLAG_STRIP_BACKTICK
            ]
        ]
    ];
 }

namespace Mawuekom\RequestSanitizer\Contracts;

/**
 * Request sanitizer contract
 *
 * Class DataManagerRepo
 *
 * @package Mawuekom\RequestSanitizer\Contracts
 */
interface SanitizerContract
{
    /**
     * Sanitize an input and return it.
     *
     * @param $input
     * @return mixed
     */
    public function sanitize($input);
}