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

Peststan Laravel Package

mrpunyapal/peststan

PestStan integrates PHPStan with the Pest testing framework, making static analysis fit naturally into your test workflow. Adds Pest-friendly configuration and helpers so you can run PHPStan on your codebase with minimal setup.

View on GitHub
Deep Wiki
Context7

PhpStan support for Pest

Frequently asked questions about Peststan
How do I install PestStan in a Laravel project?
Run `composer require mrpunyapal/peststan --dev` in your Laravel project. Ensure you also have Pest (`pestphp/pest`) and PhpStan (`phpstan/phpstan`) installed. The package integrates automatically with your existing Pest setup.
Does PestStan work with Laravel’s Eloquent models and Collections?
PestStan supports Eloquent models and Collections out of the box, but you may need to configure custom PhpStan extensions for complex Laravel-specific types. Check the PhpStan Laravel extension (`nunomaduro/collision`) for additional rules.
Will PestStan slow down my test suite significantly?
Running PhpStan on every test file can add overhead, but you can optimize by using Pest’s `--with-stan` flag selectively or running it only in CI. For large suites, consider parallel execution or limiting checks to critical paths.
Can I use PestStan with Laravel’s service container bindings?
Yes, PestStan will analyze type safety in your service container bindings, including interfaces, abstract classes, and resolved dependencies. Ensure your container bindings are properly typed to avoid false positives.
How do I handle false positives in PestStan for Laravel’s dynamic features?
False positives often occur with magic methods or dynamic properties. Extend PhpStan with Laravel-specific rules or suppress errors using `@phpstan-ignore` in Pest tests. The `nunomaduro/collision` package provides helpful extensions.
Does PestStan support Laravel 10 and newer versions?
PestStan is designed to work with modern Laravel versions (10+) and Pest 2.x. Verify compatibility by checking the package’s `composer.json` for Laravel and Pest version constraints before installation.
Can I integrate PestStan into GitHub Actions for CI/CD?
Yes, add PestStan to your GitHub Actions workflow by running `./vendor/bin/pest --with-stan` in your test job. Configure it to fail the build on PhpStan errors or warnings, depending on your team’s preferences.
What’s the difference between PestStan and running PhpStan separately?
PestStan integrates PhpStan directly into Pest’s execution flow, making it easier to catch type issues during test runs. Running PhpStan separately requires additional configuration and doesn’t leverage Pest’s test isolation features.
How do I configure PestStan for specific test files or suites?
Use Pest’s `@type-check` tag to opt into PhpStan checks for specific test files or suites. Alternatively, configure the `--with-stan` flag in your Pest command to run checks selectively or globally.
Are there alternatives to PestStan for type-checking Pest tests?
You could use PhpStan directly with a custom script or integrate it via PHPUnit, but PestStan provides a tighter integration with Pest’s modern syntax and Laravel-friendly features, reducing setup complexity.
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui