PHPackages                             laravelsecurityaudit/laravel-secret-scanner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. laravelsecurityaudit/laravel-secret-scanner

ActiveLibrary[Security](/categories/security)

laravelsecurityaudit/laravel-secret-scanner
===========================================

Framework-agnostic secret and PII detection engine: rules, scanner, redactor, severity and confidence model. Shared core for the Laravel Security Audit guard packages.

v0.1.0(1mo ago)063↓50%3MITPHPPHP ^8.2CI passing

Since Jun 28Pushed 1mo agoCompare

[ Source](https://github.com/laravelsecurityaudit/laravel-secret-scanner)[ Packagist](https://packagist.org/packages/laravelsecurityaudit/laravel-secret-scanner)[ Docs](https://github.com/laravelsecurityaudit/laravel-secret-scanner)[ RSS](/packages/laravelsecurityaudit-laravel-secret-scanner/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (3)Versions (2)Used By (3)

Laravel Secret Scanner
======================

[](#laravel-secret-scanner)

The shared detection engine behind the Laravel Security Audit guard packages. Framework-agnostic: rules, a scanner, a redactor, and a severity and confidence model, with zero Laravel dependency.

It is the core that `laravel-mail-guard` (outgoing mail) and `laravel-ai-egress-guard` (outbound AI traffic) both build on. One engine, every channel.

> This is an independent open-source package. It is not affiliated with, endorsed by, or sponsored by Laravel or Laravel LLC.

Requirements
------------

[](#requirements)

- PHP 8.2+

Installation
------------

[](#installation)

```
composer require laravelsecurityaudit/laravel-secret-scanner
```

Concept
-------

[](#concept)

A channel implements `ScanContext` to expose the text to scan. A `Rule` inspects that context and yields immutable `Finding`s. The `Scanner` runs a set of rules, isolates a broken rule so it can never stop a scan, and computes a risk level. The `Redactor` masks critical, high-confidence matches in a copy of the content. `GuardDecision` answers whether a set of findings is severe and confident enough to block.

```
use LaravelSecurityAudit\SecretScanner\Scanning\Scanner;
use LaravelSecurityAudit\SecretScanner\Scanning\Contracts\ScanContext;
use LaravelSecurityAudit\SecretScanner\Rules\Secrets\StripeKeyRule;

final class StringContext implements ScanContext
{
    public function __construct(private string $body) {}
    public function body(): string { return $this->body; }
    public function location(): string { return 'body'; }
}

$scanner = new Scanner([new StripeKeyRule]);
$findings = $scanner->scan(new StringContext('token sk_live_0123456789abcdef'));

$scanner->riskLevel($findings); // "critical"
```

Bundled rules
-------------

[](#bundled-rules)

Rule idSeverityConfidence`secrets.private_key`criticalhigh`secrets.stripe_key`criticalhigh`pii.credit_card`criticalhighAdd your own by implementing `LaravelSecurityAudit\SecretScanner\Scanning\Contracts\Rule`.

Testing
-------

[](#testing)

```
composer test
composer analyse
```

The Laravel Security Audit family
---------------------------------

[](#the-laravel-security-audit-family)

One detection engine, guarding every place data leaves your app.

PackageWhat it guards**laravel-secret-scanner** (this package)Shared secret and PII detection engine (the core)[laravel-mail-guard](https://packagist.org/packages/laravelsecurityaudit/laravel-mail-guard)Outgoing Laravel mail[laravel-ai-egress-guard](https://packagist.org/packages/laravelsecurityaudit/laravel-ai-egress-guard)Outbound AI provider traffic (OpenAI, Anthropic, Gemini)[laravel-ai-lint](https://packagist.org/packages/laravelsecurityaudit/laravel-ai-lint)Static analysis: leaked AI keys and unsafe AI wiring[laravel-ai-circuit-breaker](https://packagist.org/packages/laravelsecurityaudit/laravel-ai-circuit-breaker)Runaway AI loops and spend[laravel-ai-ledger](https://packagist.org/packages/laravelsecurityaudit/laravel-ai-ledger)GDPR Article 30 processing ledger for AI trafficLicense
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/afa88251494388c616878c63f05e227db8524f18bb98f6b2e51b5788ec4cec25?d=identicon)[laravelsecurityaudit](/maintainers/laravelsecurityaudit)

---

Top Contributors

[![workaandrey](https://avatars.githubusercontent.com/u/1831403?v=4)](https://github.com/workaandrey "workaandrey (4 commits)")

---

Tags

securitysecretsscannerredactionpii

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/laravelsecurityaudit-laravel-secret-scanner/health.svg)

```
[![Health](https://phpackages.com/badges/laravelsecurityaudit-laravel-secret-scanner/health.svg)](https://phpackages.com/packages/laravelsecurityaudit-laravel-secret-scanner)
```

###  Alternatives

[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33933.4M139](/packages/enlightn-security-checker)[psecio/parse

A PHP Security Scanner

38473.0k1](/packages/psecio-parse)[psecio/versionscan

A PHP version scanner for reporting possible vulnerabilities

25056.4k1](/packages/psecio-versionscan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
