PHP code example of ductran / sensitive-filter

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

    

ductran / sensitive-filter example snippets


use \Ductran\SensitiveFilter\Facades\SensitiveFilter;

  $filter = new \Ductran\SensitiveFilter\SensitiveFilter();
  $filter->addProcessor(new \Ductran\SensitiveFilter\EmailProcessor());
  echo $filter->filter('[email protected] adasd [email protected]');

  $filter = new \Ductran\SensitiveFilter\SensitiveFilter();
  $filter->addProcessor(new \Ductran\SensitiveFilter\IdCardProcessor());
  echo $filter->filter('dadads2478-8339-3242-2423dsdsa2478-8339-3242-2424');
  

  SensitiveFilter::on()->withRegex('/[0-9]{10}/')->withRegex('/([a-z0-9_-]{6,9})/')->filter('$$$^^^&[myp4ssw0rd] 0979306603');