Closed rusrazvan closed 2 years ago
How you do in PDO is a different subject.
This is how you can apply rules : https://auraphp.com/packages/2.x/Filter/subject-filter.html#4-7-3-2
For the sake of record I am creating a sample code.
<?php
require __DIR__ . '/vendor/autoload.php';
use Aura\Filter\FilterFactory;
$filter_factory = new FilterFactory();
$filter = $filter_factory->newSubjectFilter();
$filter->sanitize('field')->to('alpha');
$subject = [
'field' => '123abcd'
];
$filter->apply($subject);
var_dump($subject);
You can use the value from the $subject
array which will be modified when you apply the filter.
Hello,
Excuse my ignorance, I'm not advanced in PHP. I do not understand how after validating the data you can return the sanitized data to use them in queries like inserting data. For example:
Thank you in advance!