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

Phpstan Symfony Laravel Package

phpstan/phpstan-symfony

PHPStan extension for Symfony that improves static analysis with precise return types and framework-specific rules. Understands container/services, parameters, controllers, request/headers, serializer, forms, messenger handlers, cache callbacks, config tree builders, and more.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: This package integrates seamlessly with Symfony applications using PHPStan for static analysis. It extends PHPStan's capabilities to understand Symfony-specific patterns (container services, console commands, Messenger handlers), filling critical type inference gaps in the framework. The extension is purpose-built for Symfony's architecture, leveraging the container XML dump for accurate metadata.

Integration feasibility: High feasibility via Composer dependency. Requires minimal setup if using phpstan/extension-installer, but manual configuration is straightforward. Critical dependency on Symfony's container cache generation (cache:clear), which must be executed before analysis. Configuration complexity scales with project size and Symfony version (e.g., Symfony 5.3+ requires additional scanDirectories/scanFiles).

Technical risk: Moderate. Misconfigured containerXmlPath causes false negatives (undetected errors). Dependency on Symfony's cache structure creates fragility during framework upgrades or custom container configurations. Potential for false positives when using dynamic service resolution or optional dependencies (e.g., has() checks). Compatibility risks exist for non-standard Symfony deployments (e.g., custom kernel setups).

Key questions:

  • How does the extension handle container configuration changes during CI/CD pipelines?
  • What is the performance impact on large codebases (>10k files)?
  • Does it support legacy Symfony 3 applications?
  • How are custom service tags or dynamic service definitions handled?
  • What are the known limitations for Symfony DX components (e.g., Messenger, Serializer)?

Integration Approach

Stack fit: Ideal for Symfony projects using PHPStan for quality gates. Requires PHPStan 1.0+ and Symfony 4.4+. Works best with standard Symfony directory structures. Compatible with both monolithic and microservice architectures when container XML is accessible.

Migration path:

  1. Install via composer require --dev phpstan/phpstan-symfony
  2. Generate container cache (bin/console cache:clear --env=dev)
  3. Configure phpstan.neon with containerXmlPath matching Symfony version
  4. For Symfony 5.3+, add scanDirectories and scanFiles for config files
  5. Optionally enable console command analysis via consoleApplicationLoader
  6. Run PHPStan with --level=max to leverage all rules

Compatibility: Fully supports Symfony 4.4–6.x. Requires PHP 8.0+ for latest versions. Known to conflict with custom container compilers that modify service definitions after cache generation. Works with Composer 2.x but may need adjustment for non-standard autolo

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport