Class not found errors usually come from autoload configuration, namespace mismatches, missing packages or case-sensitive file paths after deployment.
Workflow
- Copy the exact error, namespace, file path and line number.
- Check that the class namespace matches composer.json PSR-4 configuration.
- Run composer dump-autoload and clear framework caches when applicable.
- Verify package installation in vendor and confirm PHP version compatibility.
- Check filename case on Linux deployments because local macOS or Windows may hide case mistakes.
Checks before production
- Do not edit vendor files to fix autoload problems.
- Check deployed files, not only local files.
- Compare CLI PHP version with web server PHP version when behavior differs.
- Use a small reproduction before changing broad application structure.
FAQ
Why does it work locally but fail on Linux?
Case-sensitive paths and different PHP or Composer versions are common causes.
Should I delete vendor?
Usually start with composer install and dump-autoload. Delete vendor only when you intentionally rebuild dependencies.
Related tools
PHP
PHP Error Explainer
Paste common PHP errors and get likely causes, fixes and verification steps for runtime, syntax and dependency problems.
Open tool ENV .env GeneratorGenerate clean .env starter files for local development, app configuration, databases, Redis, mail and API placeholders.
Open tool Docker Docker Compose GeneratorGenerate starter docker-compose.yml snippets for common local development stacks.
Open toolLast updated: May 18, 2026