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
Phpstan Baseline Per Identifier

Phpstan Baseline Per Identifier Laravel Package

shipmonk/phpstan-baseline-per-identifier

Splits your PHPStan baseline into one file per error identifier, with a loader that includes them all. Keeps baselines readable and reduces merge conflicts. Works with PHPStan 2.x baseline generation plus a simple split command.

View on GitHub
Deep Wiki
Context7

PHPStan Baseline per Error Identifier

shipmonk/phpstan-baseline-per-identifier splits a PHPStan baseline into one file per error identifier, making large baselines easier to review and maintain. Instead of a single monolithic phpstan-baseline.neon, it produces files like empty.notAllowed.neon and foreach.nonIterable.neon, plus a _loader.neon that includes them all.

  • Splits baselines by error identifier
  • Generates a _loader.neon include file
  • Integrates with native --generate-baseline
  • Reduces merge conflicts in team projects
  • Supports PHPStan 1.x via legacy usage
Frequently asked questions about Phpstan Baseline Per Identifier
What does shipmonk/phpstan-baseline-per-identifier do?
It splits a PHPStan baseline into multiple files, one per error identifier, instead of keeping one large baseline. It generates a loader neon file and places per-identifier baseline files beside it. You then include the loader in phpstan.neon.dist so PHPStan ignores the same errors with better organization. This makes large Laravel or PHP codebases easier to review and maintain.
How do I install and configure shipmonk/phpstan-baseline-per-identifier in Laravel?
Install it as a dev dependency with composer require --dev shipmonk/phpstan-baseline-per-identifier. Remove your old single phpstan-baseline.neon include, then run vendor/bin/phpstan --generate-baseline=baselines/_loader.neon followed by vendor/bin/split-phpstan-baseline baselines/_loader.neon. Finally add baselines/_loader.neon to the includes section of phpstan.neon.dist. Laravel projects already using PHPStan can adopt it without extra infrastructure.
Does shipmonk/phpstan-baseline-per-identifier support PHPStan 2.0?
Yes. Version 2.0 and later use PHPStan 2.0 native baseline generation, so you generate a baseline normally and then run the split-phpstan-baseline CLI against the loader file. Legacy extension usage remains available for PHPStan 1.x, but it is deprecated since 2.0. The legacy path also cannot utilize result cache and does not support rawMessage.
What PHP version is required for shipmonk/phpstan-baseline-per-identifier 2.4.0?
The 2.4.0 release requires PHP 8.1 or higher and PHPStan 2.0 or higher. Teams running PHP below 8.1 must upgrade local, CI, and container runtime images before updating the package. This aligns with modern Laravel versions but may require platform work in legacy environments.
How do I regenerate the split baseline automatically with Composer?
Add a Composer script such as generate:baseline:phpstan that runs phpstan --generate-baseline=baselines/_loader.neon and then split-phpstan-baseline baselines/_loader.neon. Then run composer generate:baseline:phpstan whenever you need to refresh ignored errors. This keeps regeneration consistent across developers and CI. The CLI workflow remains compatible with existing Composer and CI scripts.
Does it support both neon and PHP baseline files?
Yes, the package supports both neon baselines and PHP baselines. You can generate the baseline format your project uses and then split it into per-identifier files. Release 2.4.0 specifically improves PHP baseline handling and cleanup safety. Validate generated PHP baselines for path and ordering changes before merging.
Is orphan cleanup safe if my baseline directory contains other files?
Release 2.4.0 improves cleanup safety by deleting only baseline files and preserving non-baseline files next to the loader. This matters if your loader directory is mixed with custom files or generated artifacts. Still review cleanup behavior in any mixed directory before rolling it out broadly. The goal is to avoid accidental deletion outside the generated baseline set.
Why do generated PHP baselines use absolute paths, and will that cause diffs?
The PHP baseline path handling writes absolute paths without the __DIR__ prefix, which can introduce environment-specific differences. Local, CI, and container checkouts may use different absolute paths, so review diffs for portability and noise. Validate the generated PHP baseline across the environments where PHPStan runs. If path churn is a concern, test before committing regenerated baselines.
Can splitting a PHPStan baseline into many files affect PHPStan performance?
The package loads many small baseline files through the generated loader, so very large repositories with thousands of identifiers may notice loader overhead. In most Laravel projects the benefit is clearer ownership and smaller diffs rather than raw load speed. Measure PHPStan run times if you have an unusually large baseline. PHPStan result cache behavior also differs between native split usage and the legacy extension.
Is shipmonk/phpstan-baseline-per-identifier actively maintained?
Active maintenance is visible in releases such as 2.4.0, which improved cleanup safety and PHP baseline regeneration. The package tracks PHPStan 2.0 native usage while keeping legacy extension support for 1.x. Because it is a niche tool, document your version constraints, generated-file conventions, and rollback steps. When PHPStan upgrades change error message formats, regenerate the split baseline in a branch and review the diffs before merging.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource