ductran/sensitive-filter

Detect & Hide sensitive data in string

v0.1.1-beta 2017-11-01 08:10 UTC

This package is not auto-updated.

Last update: 2024-11-10 02:29:54 UTC


README

Hide sensitive information in string

Packagist Packagist Travis Codecov Packagist

Installation

$ composer require ductran/sensitive-filter

Usage

use \Ductran\SensitiveFilter\Facades\SensitiveFilter;

Hide Email

  $filter = new \Ductran\SensitiveFilter\SensitiveFilter();
  $filter->addProcessor(new \Ductran\SensitiveFilter\EmailProcessor());
  echo $filter->filter('duc@gmail.com adasd test@gmail.com');

Hide Id Card

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

Hide string matching regex string

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

Contributing

  1. Fork it!
  2. Create your feature branch: $ git checkout -b feature/your-new-feature
  3. Commit your changes: $ git commit -am 'Add some feature'
  4. Push to the branch: $ git push origin feature/your-new-feature
  5. Submit a pull request.

License

MIT License