clcbws / laravel-integrity
High-Fidelity Static AST & Container Reflection Integrity Suite for Laravel & Livewire.
Requires
- php: >=8.2
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- nikic/php-parser: ^5.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
README
High-Fidelity Static AST & Container Reflection Integrity Suite for Laravel & Livewire (Laravel 11.x / 12.x / 13.x | PHP 8.2+).
Zero Runtime Production Overhead.
Documentation
For detailed configurations, lists of checks, and architectural references, visit our official documentation:
- Getting Started & Installation
- Configuration Guide
- Architecture & Splicing Deep-Dive
- Full Checks Reference Guide
- CLI Configuration & Troubleshooting
- Composer Hooks Integration
- Extending & Custom Checks
Features
- Module Residue Cleanup: Identifies orphaned views, dangling controller actions, dead service providers, and unlinked seeders.
- Template & Livewire Integrity: Audits Blade templates and Livewire component views for named route existence, correct
<livewire:alias />resolution, public action methods, and public model binding property visibilities. - Import & Type Hygiene (with
--fix): Enforces strict types (declare(strict_types=1);), repairs inline root namespace facade calls (e.g.\DB::->DB::), and cleans up unused imports. - Post-Deploy Pre-Flight checks: Checks for closure routes (which prevents serialization under
route:cache), unapplied database migrations, syntax errors in Blade templates, and Eloquent models mapping to missing database tables.
Installation
You can install the package via Composer (view on Packagist):
composer require clcbws/laravel-integrity --dev
Publish the default configuration file:
php artisan vendor:publish --tag=integrity-config
Usage
1. Audit Check Pipeline
Run all lightweight, static checks across the configured directories:
php artisan integrity:check
Include database connections and full Blade compilation checks:
php artisan integrity:check --full
Fail with a non-zero exit code if any issues are identified (ideal for CI pipelines):
php artisan integrity:check --strict
Scan only Git staged/modified files (ideal for pre-commit hooks):
php artisan integrity:check --dirty
Filter by check category:
php artisan integrity:check --only=hygiene,livewire
Auto-Remediation
Automatically fix strict types, root facade references, and unused imports:
php artisan integrity:fix
Fix staged files only:
php artisan integrity:fix --dirty
Baseline Management
Snapshot existing codebase issues into .integrity-baseline.json to ignore them on subsequent check runs:
php artisan integrity:baseline
License
The MIT License (MIT). Please see License File for more information.
