Open source · MIT · PHP 8.3+

Inspect any Laravel project. Touch nothing.

larainspect is a read-only command-line tool. Point it at a Laravel application and get its stack, dependencies, routes, configuration, database schema, security risks, architecture and code quality. It can also ask an AI model to explain what it found.

git clone https://github.com/mrunknown0001/laravel-project-inspector.git
larainspect security ./insecure-app
Findings
--------
CRITICAL 1. .env is committed to version control
HIGH 2. Debug mode is enabled in a production environment
HIGH 3. APP_KEY is not set
HIGH 5. CORS allows any origin together with credentials
HIGH 11. A public route calls phpinfo()
HIGH 13. CSRF protection is disabled for all routes
HIGH 16. Raw SQL built with request input (potential)
MEDIUM 19. Session cookie is readable by JavaScript
...

Summary
CRITICAL 1  HIGH 16  MEDIUM 16  LOW 7  INFO 1
Real output from the deliberately insecure test project.
8analyzers
4AI providers, all optional
300automated tests on Linux, macOS and Windows
0files written to your project

01 The first day with an inherited codebase, in one command

Every new project starts with the same questions. larainspect inspect answers all of them at once.

  • Which Laravel version is this, and is it still getting security fixes?environment
  • Is composer.lock in sync? Do the locked packages fit the PHP version?dependencies
  • Which routes are public, and which ones shouldn't be?routes
  • Is debug mode on in production? Are cookies and CORS set up safely?configuration
  • Are secrets committed? Is request input reaching raw SQL or a shell?security
  • What tables exist, and which foreign keys have no index?database
  • Where does the business logic live: controllers, services, actions?architecture
  • Are there tests, static analysis and CI?quality

02 Eight analyzers, one report

Run them all with inspect, one at a time with its own command, or pick some with --only.

01

environment

Laravel version and support window, PHP requirement, Composer and Node versions, Vite or Mix, Livewire/Inertia/Vue/React, and the database, cache, queue and session drivers.

env.laravel-end-of-life
02

dependencies

Lock drift, PHP version conflicts, vendor drift, abandoned packages, Packagist security advisories, outdated packages and insecure Composer settings.

deps.security-advisory
03

routes

Routes rebuilt from bootstrap/app.php or RouteServiceProvider: groups, prefixes, resources, controller groups and controller middleware, each classified by access control.

routes.duplicate
04

configuration

App, session, cache, queue, logging, CORS, filesystem, auth and hashing settings, with where each value came from, plus production misconfiguration.

config.production-sync-queue
05

database

Connections and engine, and the tables, foreign keys and indexes defined in migrations. Flags likely missing indexes. It never connects to the database.

db.missing-index
06

security

Debug mode, APP_KEY, cookies, CORS, committed secrets, sensitive files, risky routes, CSRF exclusions, injection patterns, mass assignment, unescaped Blade output and more.

sec.csrf-disabled
07

architecture

Controllers, models, services, repositories, jobs, events, Livewire/Filament/Inertia, integrations and authentication packages, plus a plain-English overview.

arch.large-classes
08

quality

PHPStan/Larastan, Pint/PHP CS Fixer/PHP_CodeSniffer, Rector, tests and CI configuration. Tools can optionally be run in report-only mode.

quality.no-tests

03 How it works

Nothing in your project is executed or included. The inspector reads files and parses them.

  1. IN

    Your project

    Opened read-only. Every path is confined to the project root, and symlinks pointing outside it are refused.

  2. PARSE

    Static readers

    Only harmless .env keys are read. Config files, routes, migrations and classes are parsed with nikic/php-parser, never run.

  3. CHECK

    8 analyzers

    Facts and findings, each with a severity, a confidence, evidence and a fix.

  4. SCRUB

    Redactor

    Removes .env secrets, API tokens, private keys and URL passwords from everything that follows.

  5. OUT

    Reports

    Terminal, Markdown, self-contained HTML or JSON, plus optional AI explanations.

The only commands it runs on its own

composer audit --locked --no-plugins --no-scripts composer outdated --direct --locked --no-plugins --no-scripts git -c core.fsmonitor=false ls-files composer --version · node --version · npm --version

Each runs without a shell, has a timeout, and is recorded in reports/audit.log. Add --offline to skip the two that contact Packagist.

04 Every finding comes with its evidence

The inspector says how sure it is, and why.

HIGH
Severity, from CRITICAL down to INFO. The same scale in every format.
confirmed
Proven by the evidence, for example a value read from .env.
potential
A risky pattern worth reviewing. These checks look at single expressions, so they never claim more than that.
detected / inferred
Every fact says whether it was read directly, or derived from defaults, constraints or .env.example.
HIGH potential sec.sql-injection

Raw SQL built with request input

Why it matters

Request input is concatenated or passed directly into a raw SQL expression, which allows SQL injection.

Evidence

app/Http/Controllers/ReportController.php:14
$rows = DB::select("SELECT * FROM orders WHERE status = '" . $request->input('status') . "'");

Fix

Use query builder methods or bindings: whereRaw("email = ?", [$email]). Never concatenate input into SQL.

05 Built for code you don't trust yet

Never modifies the project

Files are read through a reader that has no write methods. Writing reports inside the project is refused, including via .. or a symlink.

Runs no project code

It doesn't run artisan, never includes PHP files and never connects to the database. Running artisan or the project's tools needs a flag and your confirmation.

Keeps secrets out

Only harmless .env keys are read. Secret findings show a location and a masked prefix, never the value.

Restricts external commands

Allowlisted programs only, no shell, timeouts. Composer runs without the project's plugins and scripts.

Logs every operation

Each command and AI request is written to the audit log and listed in the report's Operations section.

Sends nothing silently

No telemetry. Packagist sees package names only, and --offline stops even that.

An independent review of the safety-critical code found two real gaps before release. Both were fixed, and each has a regression test.

06 AI explanations, on your terms

Off by default. When you ask for it, the model gets the redacted results, never your code.

What the model receives

  • Findings: rule ID, severity, confidence, explanation, evidence, fix
  • Facts such as versions and drivers, each with its source
  • Summary counts: routes, components, packages

What it never receives

  • Source code
  • .env files or any secret value
  • Your absolute paths (replaced by <project> and ~)
  • The audit log or full route list
review before you send
$ larainspect ai ./app --dry-run      # prints the exact prompts, sends nothing
$ larainspect ai ./app --provider=anthropic
$ larainspect ai --ai-task=documentation --provider=openrouter --model=anthropic/claude-opus-4.5
Providers: switch with --provider, and pass any model ID the provider accepts with --model
ProviderSettingDefault modelNotes
AnthropicANTHROPIC_API_KEYclaude-opus-5-5Messages API, version 2026-10-21; refusals handled
OpenAIOPENAI_API_KEYset OPENAI_MODELBase URL override works with compatible servers
OpenRouterOPENROUTER_API_KEYset OPENROUTER_MODELCost reported when available
NoTokenLimitNOTOKENLIMIT_API_KEYset NOTOKENLIMIT_MODELThird-party reseller; adapter based on observed API behaviour
explain-findings security-fixes technical-debt architecture dependencies documentation best-practices

The first three run by default, one request each. AI output gets its own section, labelled AI-generated. It never adds findings or changes severities.

07 Reports you can share, gates you can trust

TTY

Colour terminal output. Add -v for evidence and fixes.

.md

Markdown for pull requests, wikis and tickets.

.html

One self-contained file with no external assets. See one.

.json

Stable schema for tooling. report can re-render it later.

.github/workflows/inspect.yml
- run: |
    git clone --depth 1 https://github.com/mrunknown0001/laravel-project-inspector.git inspector
    composer install --no-dev --working-dir=inspector
- run: php inspector/bin/larainspect inspect app \
    --format=markdown --output=inspection.md --fail-on=high
Exit codes
0Success
1Error: invalid path, not a Laravel app, or an unconfigured AI provider
2A finding met the --fail-on threshold

08 Install in a minute

You need PHP 8.3+ and Composer 2. It lives in its own folder, not inside your project.

$ git clone https://github.com/mrunknown0001/laravel-project-inspector.git ~/tools/laravel-project-inspector
$ cd ~/tools/laravel-project-inspector && composer install --no-dev
$ ln -s "$PWD/bin/larainspect" ~/.local/bin/larainspect
$ cd ~ && larainspect inspect ~/projects/shop
> git clone https://github.com/mrunknown0001/laravel-project-inspector.git C:\Tools\laravel-project-inspector
> cd C:\Tools\laravel-project-inspector
> composer install --no-dev
> bin\larainspect.bat inspect C:\Projects\shop
$ composer global config repositories.larainspect vcs https://github.com/mrunknown0001/laravel-project-inspector.git
$ composer global require larainspect/laravel-project-inspector:dev-main
$ larainspect inspect ~/projects/shop

Full instructions, including adding it to PATH on Windows and troubleshooting, are in the installation guide.

09 Where it stands

Linux, WSLDeveloped and used on real projects; CI on PHP 8.3, 8.4, 8.5
macOSFull test suite passes in CI; not yet tried on real projects
WindowsTest suite passes in CI; not yet tried on real projects
Laravel8 and later; older versions best-effort; Lumen not supported

What it can't do

  • It can't see routes that packages register at runtime, unless you pass --use-artisan.
  • Code-pattern checks don't follow data through variables. A potential finding needs review, and a clean report doesn't prove the code is safe.
  • It doesn't replace a security audit or a penetration test.

Point it at a project.
Read the report.