Mask Sensitive Data With the PHP Masked Package

Mask Sensitive Data With the PHP Masked Package

Fuko\Masked is a small PHP library by Kaloyan Tsvetkov for masking sensitive data by replacing blacklisted elements with a redacted value.

Here’s an example of the basic usage from the package’s readme:

use Fuko\Masked\Protect;

// hide the value inside the $secret_key var

// hide the value of $_POST['password']
Protect::hideInput('password', INPUT_POST);

$redacted = Protect::protect($_POST);

Based on the above calls, the blacklisted values and inputs will be masked. Another example from the readme is a debug blacklist, similar to Laravel 5’s Whoops blacklist:

use \Fuko\Masked\Protect;

    INPUT_ENV => array(
    INPUT_SERVER => array(
    INPUT_POST => array(

// Passing info through `\Fuko\Masked\Protect::protect()`
// will mask the blacklisted inputs.

Check out the readme for more examples, including custom masking rules. You can learn more about this package, get full installation instructions, and view the source code on GitHub at fuko-php/masked.

Related: PHP Array Redactor

Filed in: News / packages
Laravel News Partners

Laravel Jobs

Web Application Developer (Vue.js & Laravel)
Apero Creative Development
Full Stack PHP Engineer
Alexandria, VA
Engage, LLC
Mid / Senior Laravel / Vue Engineer
Clearwater, FL
Platform Engineer
Intermediate Laravel Developer
Austin, TX
Elevation Energy Group


Join 31,000+ others and never miss out on new tips, tutorials, and more.