Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Analyzer Laravel Package

graham-campbell/analyzer

Analyzer by Graham Campbell statically checks your PHP code to ensure referenced classes actually exist, helping catch typos and missing dependencies early. Supports PHP 8.1–8.5 and integrates with PHPUnit 10–13.

View on GitHub
Deep Wiki
Context7

Checks if referenced classes really exist.

Frequently asked questions about Analyzer
How do I install Analyzer in a Laravel project?
Run `composer require graham-campbell/analyzer --dev` to install it as a development dependency. It requires PHP 8.1–8.5 and PHPUnit 10–13. No additional configuration is needed for basic usage.
Does Analyzer work with Laravel Facades (e.g., Cache::store())?
Analyzer may flag Facades as errors by default since they dynamically resolve classes. To fix this, exclude the `app/Providers/` or `app/Facades/` directories in `getIgnored()` or extend `shouldAnalyzeFile()` to whitelist them.
Can Analyzer catch typos in PHPDoc annotations (e.g., @method, @property) in Laravel Policies or Form Requests?
Yes, Analyzer validates PHPDoc references just like regular class references. It’s especially useful for catching typos in Laravel’s annotation-heavy components like Policies, Form Requests, and API Resources.
Will Analyzer slow down my CI pipeline significantly?
Analyzer is lightweight (~1–2 seconds for medium Laravel apps) and can be parallelized. For large codebases, cache results with `composer cache:clear` or run it in parallel using tools like `php-parallel-lint`.
How do I integrate Analyzer into GitHub Actions or GitLab CI?
Add it to your CI script like this: `composer run analyzer`. Use `fail-on-error: true` to block PR merges. Example for GitHub Actions: `- name: Run Analyzer run: composer run analyzer`.
Does Analyzer support Laravel’s Service Providers or API Resources?
Yes, Analyzer is designed for Laravel’s ecosystem and will validate class references in Service Providers, API Resources, and other core components. Just ensure the paths are included in `getPaths()`.
What if Analyzer flags a false positive (e.g., dynamic class loading with `class_alias()`)?
Exclude problematic paths in `getIgnored()` or override `shouldAnalyzeFile()` to skip dynamic class loading. For example, ignore `vendor/` or custom directories where dynamic loading occurs.
Can I use Analyzer alongside PHPStan or Psalm?
Yes, Analyzer acts as a pre-filter to reduce false positives in PHPStan/Psalm by 30–50% for class-related issues. Run Analyzer first in your CI pipeline to catch obvious errors before deeper static analysis.
What Laravel versions does Analyzer support?
Analyzer is framework-agnostic but optimized for Laravel 9+. It works with any Laravel version that uses PHP 8.1–8.5, including Service Providers, Facades, and Eloquent models.
How do I customize Analyzer to ignore third-party SDKs (e.g., stripe/stripe-php)?
Use `getIgnored()` to exclude vendor paths like `vendor/stripe/`. For SDK-specific PHPDoc issues, extend `shouldAnalyzeFile()` to filter out SDK directories or override validation logic for known-safe references.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope