roslov / log-obfuscator
Log Obfuscator
Installs: 2 426
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 2
Requires
- php: ^7.4|^8.0
- ext-mbstring: *
- symfony/polyfill-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^9.5
- roslov/psr12ext: ^9.1
README
This package hides sensitive information in text (usually, in logs).
Requirements
- PHP 7.4 or higher.
Installation
The package could be installed with composer:
composer require roslov/log-obfuscator
General usage
#!/usr/bin/env php <?php declare(strict_types=1); use Roslov\LogObfuscator\LogObfuscator; require_once __DIR__ . '/vendor/autoload.php'; $obfuscator = new LogObfuscator(); $json = <<<'JSON' { "username": "user", "password": "123456789" } JSON; echo $obfuscator->obfuscate($json);
This will return:
{
"username": "user",
"password": "×××××"
}
Testing
Unit testing
The package is tested with PHPUnit. To run tests:
./vendor/bin/phpunit
Code style analysis
The code style is analyzed with PHP_CodeSniffer and PSR-12 Ext coding standard. To run code style analysis:
./vendor/bin/phpcs --extensions=php --colors --standard=PSR12Ext --ignore=vendor/* -p -s .