Developer tool
PSR-4 Autoload Checker
Check whether class paths match composer.json PSR-4 namespace prefixes.
How it works
What it does
The PSR-4 Checker compares namespace prefixes declared under autoload.psr-4 / autoload-dev.psr-4 with example class names or relative paths you provide. It helps explain “class not found” issues that are really path mapping mistakes.
When to use it
- After moving a directory without updating composer.json
- When case-sensitive Linux CI fails but macOS local passes
- Onboarding developers to your package layout
How input is processed safely
Inputs are composer.json text plus optional class/path samples. No filesystem walk of your real project occurs on the server, and Composer is never executed. Results are mapping math and validation messages only.
Examples
App\→src/correctly mapsApp\Http\Kerneltosrc/Http/Kernel.php- Detecting
app/vsApp/case mismatches - Spotting nested prefixes that accidentally overlap
Common mistakes
- Forgetting to run
composer dump-autoloadlocally after fixes - Putting classes outside the mapped directory
- Mixing PSR-0 expectations with PSR-4 layouts
PSR-4 maps a namespace prefix to a base directory; everything after the prefix must mirror directories and the class-ending file name. Case must match on Linux production hosts even if a macOS laptop forgives you. That single difference causes many “works locally” autoload failures.
Provide the smallest failing example: the class FQCN and the relative path where the file actually lives. The checker explains whether the declared prefix can produce that path. Fix composer.json or move the file—then dump autoload in your environment.
Overlapping prefixes and incorrect trailing namespace separators are subtle. If two prefixes could claim the same class, simplify the mapping rather than relying on ordering luck.
Practical tips
- Keep inputs small and representative; huge pastes slow feedback and raise risk of accidental secret disclosure.
- After using PSR-4 Autoload Checker, verify the result in your own environment (correct SAPI, correct host, correct project root).
- Cross-link findings to ZendStudio.net PHP error guides and IDE setup pages when the next step is configuration rather than code edits.
- Prefer repeatable project tooling (CI, Composer scripts, IDE inspections) for repo-wide enforcement; this page is for interactive problem-solving.
Privacy note
You only need the autoload section and sample class names—not your entire application source tree.
Run in browser
AJAX processing only. No remote PHP execution sandbox. Results are not indexed.
Safety notes
- Submitted tool contents are not written to analytics or search logs.
- This site never evaluates arbitrary PHP from the browser.
- Generated configs are starting points—validate on a staging host before production.