noldors / phpstan-extension
Custom PHPStan rules for PHP and Laravel projects.
Package info
github.com/noldor/phpstan-extension
Type:phpstan-extension
pkg:composer/noldors/phpstan-extension
Requires
- php: >=8.5
- ext-mbstring: *
- phpstan/phpdoc-parser: ^2.0
- phpstan/phpstan: ^2.3
Requires (Dev)
- denzyl/phanalist: ^1.1
- larastan/larastan: ^3.13.2
- laravel/framework: ^13.38
- laravel/pint: ^1.27
- phpunit/phpunit: ^13.0
- symfony/polyfill-iconv: ^1.37
Suggests
- larastan/larastan: ^3.13.2 is required for the optional Eloquent property bridge.
Provides
None
Conflicts
None
Replaces
None
- dev-master
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.1
- v0.2.0
- v0.1.0
- v0.0.1
- dev-feature/standards-contract-implementation
- dev-feature/security-correctness-checks
- dev-feature/eloquent-model-standards
- dev-feature/laravel-application-contracts
- dev-feature/laravel-postgres-instant-columns
- dev-fix/stream-wrapper-reference-contract
- dev-feature/validators-default-path
- dev-feature/rule-sets
- dev-feature/phpstan-extension
This package is auto-updated.
Last update: 2026-10-29 19:44:16 UTC
README
Custom PHPStan rule sets for PHP and Laravel projects.
Requires PHP >=8.5, ext-mbstring and PHPStan ^2.3.
Installation
composer require --dev noldors/phpstan-extension
Connection
For a PHP project, add to phpstan.neon:
includes: - vendor/noldors/phpstan-extension/src/php.neon parameters: paths: - src
For a Laravel project, use the Laravel set, which also includes the PHP set:
includes: - vendor/noldors/phpstan-extension/src/laravel.neon parameters: paths: - app - src
Keep only existing project directories in paths. The PHP set checks reference
parameters, exception translation and mandatory JSON error flags. Its collection
and DTO checks require explicit owner/DTO scopes; see the
rule documentation.
The PHP set also enables TLS, full-request logging, assertion and PHPUnit
provider safety checks. Database builder mock checks require explicit test scopes.
The Laravel set also enables validation placement checks and adds infrastructure
APIs to the DTO configuration. Its PostgreSQL instant check requires explicitly
configured application-owned paths; see the
rule documentation. Keep your existing
Larastan configuration when analysing Laravel APIs. Application contract checks require
explicit role scopes.
For the complete opt-in Eloquent model checks, install Larastan ^3.13.2 and use the property bridge on Laravel 13.38+:
includes: - vendor/larastan/larastan/extension.neon - vendor/noldors/phpstan-extension/src/laravel-model-properties.neon parameters: paths: [app, database/factories] noldors: eloquent: modelNamespaces: [App\Models]
See Eloquent configuration and coverage and the complete Laravel attribute catalog.
The sets are opt-in. Existing src/rules.neon includes remain supported and
load the Laravel set.
Documentation
See the rule documentation for the rule catalogue, examples and configuration options.
Development
composer install composer format composer check
check runs Pint, PHPStan at maximum level, Phanalist and PHPUnit. Tests run in
random order. Intentionally invalid fixtures are excluded from direct static
analysis and formatting and are analysed by the rule tests instead.
Laravel is a development-only dependency. Lighthouse is represented by a minimal
test-only validator stub loaded via autoload-dev; the tests check inheritance
detection, not Lighthouse's runtime behaviour. Neither framework is installed
when this package is used as a dependency.
Distribution
Composer and Git dist archives contain only composer.json, MIT license.txt
and src/, including all rule-set configuration files. Documentation, tests,
tooling and dependencies stay in the source checkout. archive.exclude and
.gitattributes enforce this allowlist. A source checkout (--prefer-source)
contains the full repository.
See license.txt.
Releases
Work happens on branches from master, through PRs with passing quality checks
and tests. After an ordinary merge, GitHub Actions checks master again, creates
a SemVer tag and verifies its publication through the Packagist webhook. See the
release workflow and activation guide.