Skip to main content

Introduction

laravel/doctor is an official Laravel package that diagnoses common configuration, environment, and infrastructure problems in your application. v0.1.0 was released on July 28, 2026. Each diagnostic is a single check — it inspects one thing, such as whether Laravel can write to its storage directories, and reports one of several statuses. When the repair is safe and deterministic, a diagnostic may also offer a fix. Issues that cannot be repaired safely, such as a failed asset build, are reported with remediation steps instead.

Running Doctor

Once installed, the package registers the doctor Artisan command:
When a failing diagnostic can be fixed, Doctor reports the problem and prompts before applying the fix:
Some fixes offer a choice of repairs instead of a yes/no confirmation. When the default cache store is unreachable, for example, Doctor presents a select list of configured stores that actually work, along with an option to keep the current store and repair it manually. To apply all available fixes without prompting, pass the --fix option:
First-party fixes cover deterministic local repairs such as creating a missing .env, generating APP_KEY, disabling production debug mode, adding .env to .gitignore, creating the public storage link, and repairing writable storage directories.
Fixes are only available with the CLI and agent output formats. Doctor rejects --fix with JSON and GitHub report formats so machine-readable reports never mutate the application.
Use --bail to stop after the first diagnostic that fails or errors:

Diagnostic Statuses

Every diagnostic returns one of the following statuses: By default, the command exits with a failing status when a diagnostic fails or errors. Use --fail-on=warn to also fail on warnings, or --fail-on=never when Doctor should only report issues.

Selecting Diagnostics

Diagnostics may be selected or excluded by class name, group, package, or package wildcard. Multiple values may be passed by repeating the option or separating values with commas.
To configure persistent diagnostic selection, publish Doctor’s configuration file:

Environment Modes

Some facts about an application cannot be judged on their own. A sync queue connection is sensible on a developer’s machine, but in production it means queued jobs silently run inside web requests. To judge these diagnostics, Doctor resolves the application to one of two modes: The mode changes the verdict, not just the message. Missing bootstrap caches warn in production but pass locally. Doctor recognizes Laravel’s conventional local, production, and staging environment names out of the box. For custom names, group them in the configuration file:
Any environment not listed is treated as production, so unfamiliar environments are held to the strictest expectations rather than quietly excused.

Default Diagnostics

Doctor ships with a focused suite of diagnostics:
  • Environment.env presence, APP_KEY, PHP version, required extensions, and timezone.
  • Composer — dependencies installed, autoload optimization, repairable composer.lock problems.
  • Configuration — config files can be loaded and cached, required values are set, bootstrap cache state matches the environment.
  • Database — default connection is reachable, SQLite file exists when needed, pending migrations can be applied in local environments.
  • Cache, queue, scheduler, and session — configured drivers are reachable, sync queues are flagged outside local environments, scheduled tasks are surfaced as a notice.
  • Storage — default disk is reachable, required directories are writable, storage:link exists when expected.
  • Security — debug mode matches the environment, .env is gitignored, Composer dependencies are audited.

Creating Diagnostics

A diagnostic extends Laravel\Doctor\Diagnostic and implements a check() method returning a DiagnosticResult. Scaffold one with the make:diagnostic Artisan command:
The following diagnostic checks whether the application key is set and implements Fixable to generate it automatically:
When a failure has several valid repairs, declare the choices with fixOptions(). The CLI renders them as a select list, and the chosen value is passed to fix():
Packages register diagnostics from their service providers using the same API:
Reports show each diagnostic’s source package next to its name:

Running Doctor Programmatically

Call Doctor::run() without the Artisan command to get a DiagnosticReport:
To apply fixes as part of a programmatic run, configure the run with fixUsing:

Output Formats and AI Agent Support

Doctor renders readable CLI output by default. JSON and GitHub Actions annotations are also available:
When Doctor detects it is running inside an AI coding agent such as Claude Code or Cursor — using Laravel Agent Detector — it defaults to an agent-optimized format following the Laravel PAO convention:
Issues marked fixable may be fixed by re-running Doctor with --fix. An explicit --format option always overrides detection. To preview agent output outside an agent:

Summary

laravel/doctor lets you quickly surface configuration, environment, and infrastructure problems with a single php artisan doctor command. Its deep integration with AI coding agents and the Laravel PAO convention makes it a natural fit for CI/CD pipelines and agent-driven auto-repair workflows.

laravel/doctor repository

Source code and latest updates.
Last modified on July 29, 2026