Automatically scan your Laravel project for common security vulnerabilities in
.envand configuration files.
Detect unsafe values, missing keys, and misconfigured HTTPS, CORS, and cookie settings β directly from your CLI.
- Features
 - Installation
 - Usage
 - What It Checks
 - Markdown Report Example
 - Configuration
 - CI/CD Integration Example
 - Compatibility
 - Support & Sponsorship
 - About the Author
 - License
 
β
 Detects risky environment variables (APP_DEBUG=true, missing APP_KEY, etc.)
β
 Scans for insecure configuration values (CORS *, SESSION_SECURE=false, QUEUE=sync, etc.)
β
 Validates HTTPS usage in URLs and cookies
β
 Generates CLI or Markdown reports for CI/CD pipelines
β
 Includes strict mode (--strict) for automated fail conditions in CI
β
 Lightweight and dependency-free β works out of the box
composer require fragly/laravel-security-tools --devAlternatively, you can register it manually in config/app.php:
'providers' => [
    Fragly\SecurityTools\SecurityToolsServiceProvider::class,
],php artisan security:scanphp artisan security:scan --format=mdOutput file (by default): storage/logs/security-report.md
php artisan security:scan --strict| Category | Example | Description | 
|---|---|---|
| Required Keys | APP_KEY, APP_URL, DB_* | 
Must exist and be non-empty | 
| Dangerous Values | APP_DEBUG=true | 
Warns if enabled in any environment | 
| Forbidden in Production | SESSION_DRIVER=array, QUEUE=sync | 
Not allowed in production | 
| Format Validation | APP_KEY, APP_URL | 
Must match regex and be valid | 
| HTTPS Enforcement | APP_URL, ASSET_URL | 
Must start with https:// in production | 
| Check | Description | 
|---|---|
app.debug=false in production | 
Prevents debug mode in prod | 
session.secure=true | 
Enforces HTTPS cookies | 
session.http_only=true | 
Protects from JS access | 
cors.allowed_origins β  * | 
Disallows wildcard CORS | 
cache.default β  array | 
Production cache driver check | 
queue.default β  sync | 
Warns if queue runs inline | 
mail.default β  log | 
Ensures real mailer in prod | 
log.level β  debug | 
Avoid verbose logs in prod | 
trustedproxy.proxies β  * | 
Ensures proxy whitelist | 
app.url uses HTTPS | 
Verifies production HTTPS URL | 
php artisan security:scan --format=md- Generated at: 2025-10-25 03:00:00
 
| Level | Area | Key | Message | Hint | 
|---|---|---|---|---|
| ERROR | env | APP_DEBUG | Dangerous value: true | Set APP_DEBUG=false in production. | 
| WARNING | config | cors.allowed_origins | CORS allows all origins (*) | Avoid "*" in production. | 
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Run security scan
run: php artisan security:scan --strict
If you like this package, you can support its development and get access to exclusive Laravel & Next.js dev tools:
This package is open-sourced software licensed under the MIT license.
π SEO Keywords
laravel security, laravel security scan, laravel .env checker, laravel vulnerability scanner,
laravel config security, laravel audit tool, laravel .env validation, laravel production best practices,
laravel https cookie secure, laravel cors security, laravel session security, laravel debugging safe setup,
laravel security tools by Fragly, laravel security artisan command, laravel security report generator,
fraglydev, fragly security, fragly.net packages