PHP code example of adamthehutt / laravel-sanitized-requests
1. Go to this page and download the library: Download adamthehutt/laravel-sanitized-requests 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/ */
adamthehutt / laravel-sanitized-requests example snippets
use AdamTheHutt\SanitizedRequests\SanitizesInput;
use AdamTheHutt\SanitizedRequests\Sanitizer;
use Illuminate\Foundation\Http\FormRequest;
class StoreItem extends FormRequest
{
use SanitizesInput;
public function sanitize(Sanitizer $sanitizer): void
{
$sanitizer->castToInt("user_id")
->castToBoolean("for_sale")
->castToFloat("price")
->forgetIfEmpty("item_description")
->trimWhitespace("nested.*.wildcard.param");
}
}