captainhook/secrets
最新稳定版本:0.9.7
Composer 安装命令:
composer require captainhook/secrets
包简介
Utility classes to detect secrets
README 文档
README
This package is used to detect passwords in your code. Mainly to prevent you from committing them to your version control.
You can use the regular expressions provided by the classes under Regex\Supplier or make use of the included Detector class.
You can easily create your own Supplier classes or open a pull-request if you think it would be useful to others.
Here are some usage examples:
Using Suppliers
$result = Detector::create() ->useSuppliers( Aws::class, Google::class, GitHub::class )->detectIn($myString) if ($result->wasSecretDetected()) { echo "secret detected: " . implode(' ', $result->matches()); }
Using your custom regex
$result = Detector::create() ->useRegex('#password = "\\S"#i') ->detectIn($myString) if ($result->wasSecretDetected()) { echo "secret detected: " . implode(' ', $result->matches()); }
The Detector also supports a white list
$result = Detector::create() ->useRegex('#password = "\\S"#i') ->allow('#root#') ->detectIn($myString) if ($result->wasSecretDetected()) { echo "secret detected: " . implode(' ', $result->matches()); }
统计信息
- 总下载量: 3.07M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04