1. Go to this page and download the library: Download dms/dms-filter-bundle 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/ */
dms / dms-filter-bundle example snippets
namespace App\Entity;
//Import Attributes
use DMS\Filter\Rules as Filter;
class User
{
#[Filter\StripTags]
#[Filter\Trim]
#[Filter\StripNewlines]
public string $name;
#[Filter\StripTags]
#[Filter\Trim]
#[Filter\StripNewlines]
public string $email;
}
public function userAction(#[Autowire(service: 'dms.filter.inner.filter')] Filter $filter): Response
{
$user = new User();
$user->setName("My <b>name</b>");
$user->setEmail(" [email protected]");
//Get a Filter
$newUser = $filter->filterEntity($car);
return new Response(
$newUser->getModel()
);
}
class TaskType extends AbstractType
{
// ...
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'cascade_filter' => false,
));
}
// ...
}
namespace App\Entity;
//Import Atributes
use DMS\Filter\Rules as Filter;
//Import Symfony Rules
use DMS\Bundle\FilterBundle\Rule as SfFilter;
class User
{
#[Filter\StripTags]
#[SfFilter\Service(service: 'dms.sample', method: 'filterIt')]
public $name;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.