Weave 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
Pest Plugin Phpstan

Pest Plugin Phpstan Laravel Package

pestphp/pest-plugin-phpstan

A Pest plugin that brings PHPStan static analysis into your Pest test suite, letting you run and assert PHPStan results directly from tests. Integrate type and error checks into your workflow without leaving Pest.

View on GitHub
Deep Wiki
Context7

PHPStan plugin for Pest

Frequently asked questions about Pest Plugin Phpstan
What is pestphp/pest-plugin-phpstan used for?
pestphp/pest-plugin-phpstan is a thin Pest plugin that exposes PHPStan as an additional entrypoint in the Pest binary, so you can run static analysis from a Pest command such as pest --phpstan. It does not reimplement PHPStan rules, configuration discovery, or reporting; PHPStan remains the source of truth for analysis. It is intended for teams that want static analysis inside an existing Pest-based quality gate.
How do I install pest-plugin-phpstan in a Laravel project?
Install it as a dev dependency with Composer, for example composer require --dev pestphp/pest-plugin-phpstan. Pest autodiscovers the plugin, so no application code changes are required. PHPStan must be installed separately, and you should validate Pest, PHPStan, and PHP version constraints before merging.
Does this plugin work with Laravel 10, 11, or 12?
This is a Composer dev package aimed at PHP and Pest projects, so Laravel version support depends on your PHP version, Pest version, and the package Composer constraints rather than a Laravel-specific version list. The overview does not provide a confirmed Laravel compatibility matrix. Test the Pest major, PHPStan major, and PHP version triple in a throwaway branch before adopting it in a Laravel application.
Do I still need to install PHPStan separately?
Yes. The plugin is glue, not a bundle, so it does not ship PHPStan or Larastan. Install and configure standalone PHPStan first, establish a clean baseline at your target level, then add the plugin and confirm the Pest entrypoint produces the same results as a direct CLI run.
Does it support phpstan.neon, --level, --baseline, and --memory-limit?
The plugin delegates analysis to PHPStan, so it should honor your PHPStan configuration and CLI options to the extent that it passes them through faithfully. Support for phpstan.neon and phpstan.neon.dist discovery plus options such as --configuration, --level, --baseline, --memory-limit, and --error-format should be confirmed for your installed version. Validate by comparing output from pest --phpstan with vendor/bin/phpstan analyse.
Can I use pest --phpstan in CI with reliable exit codes?
Static analysis gating depends on faithful exit-code propagation, so verify that pest --phpstan returns the same failure status as a direct PHPStan run. If it does, you can add an explicit exit-code-gated CI step. Keep a direct vendor/bin/phpstan CI job as a safety net so a plugin regression cannot silently disable analysis.
Is pest-plugin-phpstan compatible with Pest 2 and Pest 3?
Pest's plugin contract changed between major versions, and the plugin must also track PHPStan 1.x to 2.x changes. Do not assume compatibility with both Pest 2 and Pest 3 without checking the package Composer constraints and testing. Pin Pest, PHPStan, and the plugin explicitly, then validate in a throwaway branch before upgrading.
Does this Pest PHPStan plugin work with Larastan?
Yes, it pairs naturally with Larastan because Larastan is a PHPStan extension that supplies Laravel-specific rules. The plugin only provides the Pest entrypoint; the actual analysis and Laravel rules still come from PHPStan and Larastan. Validate the combination together, especially after Pest or PHPStan major upgrades.
What are the alternatives to using this plugin?
The main alternative is to run vendor/bin/phpstan analyse directly as its own local and CI command. You can also vendor a small equivalent adapter if you only need the Pest entrypoint. Because the plugin is thin, the fallback is low risk, and keeping a direct PHPStan job is a sensible safety net.
Is pest-plugin-phpstan safe and maintained enough for production use?
It is MIT-licensed and published under the official pestphp vendor namespace, but it is community-maintained with a low star count and weak provenance signals, so treat it as convenience rather than critical path. There is no runtime footprint because it is dev-only. Budget a dependency review whenever Pest or PHPStan ships a major release, and document the direct CLI fallback in case the plugin breaks.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections