定制 ghostwriter/redaction 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ghostwriter/redaction

Composer 安装命令:

composer require ghostwriter/redaction

包简介

Redaction library for PHP

README 文档

README

Automation PHP Version Packagist Downloads PayPal Sponsors via GitHub

Redaction library for PHP

Warning

This project is not finished yet, work in progress.

Installation

You can install the package via composer:

composer require ghostwriter/redaction

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Usage

use Ghostwriter\Redaction\Redactor;
use Ghostwriter\Redaction\Rules;
use Ghostwriter\Redaction\Rule;

###################################################
# Default redaction
###################################################
$redactor = Redactor::new();

$redactedText = $redactor->redact('GITHUB_TOKEN=abc123');
echo $redactedText; // Outputs: GITHUB_TOKEN=**REDACTED**

$redactedText = $redactor->redact('gho_abc123');
echo $redactedText; // Outputs: gho_**REDACTED**

$redactedText = $redactor->redact('ghs_abc123');
echo $redactedText; // Outputs: ghs_**REDACTED**

###################################################
# Custom redaction
###################################################
$customRules = [
    '#my_custom_pattern#iu' => '**my_custom_replacement**',
];

$redactor = Redactor::new($customRules);

$redactedText = $redactor->redact('my_custom_pattern');
echo $redactedText; // Outputs: **my_custom_replacement**

###################################################
# Custom redaction rules
###################################################
$customRules = [
    '#my_custom_pattern#iu' => '**my_custom_replacement**',
];

$rules = Rules::new($customRules);
$rules->add(Rule::new('#another_pattern#iu', '**another_replacement**'));

$redactor = new Redactor($rules);

$redactedText = $redactor->redact('my_custom_pattern');
echo $redactedText; // Outputs: **my_custom_replacement**

$redactedText = $redactor->redact('another_pattern');
echo $redactedText; // Outputs: **another_replacement**

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-06-15