psalm / plugin-laravel
Psalm plugin for Laravel
Installs: 3 648 367
Dependents: 317
Suggesters: 1
Security: 0
Stars: 305
Watchers: 9
Forks: 71
Open Issues: 17
Type:psalm-plugin
Requires
- php: ^8.1
- ext-simplexml: *
- barryvdh/laravel-ide-helper: ^2.13 || ^3.0
- illuminate/config: ^10.48 || ^11.0
- illuminate/container: ^10.48 || ^11.0
- illuminate/contracts: ^10.48 || ^11.0
- illuminate/database: ^10.48 || ^11.0
- illuminate/events: ^10.48 || ^11.0
- illuminate/http: ^10.48 || ^11.0
- illuminate/routing: ^10.48 || ^11.0
- illuminate/support: ^10.48 || ^11.0
- illuminate/view: ^10.48 || ^11.0
- nikic/php-parser: ^4.18 || ^5.0
- orchestra/testbench-core: ^8.22 || ^9.0
- symfony/console: ^6.0 || ^7.0
- symfony/finder: ^6.0 || ^7.0
- vimeo/psalm: ^5.20
Requires (Dev)
- laravel/framework: ^10.48 || ^11.0
- phpunit/phpunit: ^10.5 || ^11.0
- phpyh/psalm-tester: ^0.1.0
- ramsey/collection: ^1.3
- rector/rector: ^1.0
- slevomat/coding-standard: ^8.8
- squizlabs/php_codesniffer: *
- symfony/http-foundation: ^6.0 || ^7.0
- dev-master
- v2.11.0
- v2.10.1
- v2.10.0
- 2.9.x-dev
- v2.9.0
- v2.8.0
- v2.7.1
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- 1.x-dev
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- 1.4.x-dev
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.1
- 0.7
- 0.6
- 0.5
- 0.4
- 0.3
- 0.2.2
- 0.2.1
- 0.2
- 0.1
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-config-dynamic-analysis
This package is auto-updated.
Last update: 2024-11-02 09:28:35 UTC
README
The package is seeking maintainers
⚠️ This is a perfect opportunity to learn Laravel very deep and collaborate with other high-skilled developers. At this moment, the package is maintained almost solely by @alies-dev, and he is looking for developers to build a team who can constantly improve this package and the whole Psalm ecosystem.
Some ideas to implement:
- Fully support custom Model Query Builders (medium)
- Add an option to rely on Model
@property
declarations only - Get rid of
barryvdh/laravel-ide-helper
dependency and be more accurate with attribute types - Support .sql files for migrations (to find information about attributes and their types)
Overview
This Psalm plugin brings static analysis and type support to projects using Laravel. Our goal is to find as many type-related bugs as possible, therefore increasing developer productivity and application health. Find bugs without the overhead of writing tests!
Versions & Dependencies
Maintained versions:
See releases for more details about supported PHP, Laravel and Psalm versions.
Quickstart
Step 1: Install
composer require --dev psalm/plugin-laravel
Step 2: Configure
If you didn't use Psalm on the project before, you need to create a Psalm config:
./vendor/bin/psalm --init
Step 3: enable the plugin:
./vendor/bin/psalm-plugin enable psalm/plugin-laravel
Step 4: Run 🚀
Run your usual Psalm command:
./vendor/bin/psalm
You can customize Psalm configuration using XML config and/or cli parameters.
Recommendation: use baseline file and increase
errorLevel
at least to 4
: this way you can catch more issues. Step by step set errorLevel
to 1
and use Psalm and this plugin at full power 🚀.
How it works
Under the hood it just runs https://github.com/barryvdh/laravel-ide-helper and feeds the resultant stubs into Psalm, which can read PhpStorm meta stubs.
It also parses any database migrations it can find to try to understand property types in your database models.
Psalm-Laravel-Plugin or Larastan?
Both! It's fine to use both tools at the same project: they use different approaches to analyze code, and thus you can find more bugs! Psalm and PHPStan use almost same the syntax annotations, so you should not have any conflicts.